# Limit of parameters in command line?

This topic is 2680 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Im trying to do some heavy testing on my program... I created a text file with about 250 000 numbers, and I start my program using the text file as arguments, but the programs crashes calling abort() and I'm unable to debug my program because Visual Studio cannot run the program with some many arguments...

Is there a limit of arguments? Any ideas about what might be causing this?

##### Share on other sites

Im trying to do some heavy testing on my program... I created a text file with about 250 000 numbers, and I start my program using the text file as arguments, but the programs crashes calling abort() and I'm unable to debug my program because Visual Studio cannot run the program with some many arguments...

Is there a limit of arguments? Any ideas about what might be causing this?

Most often there is a limit to the length of the commandline that you can send a program. You can use a tool like xargs to bypass this limit. You can also have your program directly support "response files".

Even if you run the app outside VS, you can still debug it in VS. If it crashes, there is usually a crash dialog with the option to debug. Or, you can choose "attach to process" from the debug menu in VS, and choose your application.

##### Share on other sites
Having 250000 parameters in a command is crazy !
I guess they have all the same meaning. So why not have your program either
- take just the file name as parameter and read from that file
- or read from stdin (maybe that would not work on windows, I don't know)

By the way, I don't see how you manage to extract the file content's and make a command line out of it. Does VS offer this xargs-like feature ?

##### Share on other sites
Under Windows there is limit on length, not count of command line arguments: http://blogs.msdn.com/b/oldnewthing/archive/2003/12/10/56028.aspx

##### Share on other sites
Yes I take the filename as parameter and read the values from it...

I also discovered that the program only crashes when I use a list with more than 1000 values...

Can this be related to memory usage?

##### Share on other sites

Yes I take the filename as parameter and read the values from it...

I also discovered that the program only crashes when I use a list with more than 1000 values...

Can this be related to memory usage?

So you read from the file, build a command line from that, and spawn another process with this command line ?
Or is the problem not really related to a command line limit at all ?

Could you show the "bootstrap" code ?

##### Share on other sites
program.exe < input.txt

##### Share on other sites

program.exe < input.txt

If that does the same thing as on my linux shells, it should just feed the content of the file to your program's stdin.
This is no command line issue. The problem is more likely your program not handling so much input well. You'd have to show the program's code, or explain how it works, to get more help.

##### Share on other sites
If you need to pass 250,000 numbers to your program, you normally write them into a file and then pass the name of the file as an argument. Would this work for you?

##### Share on other sites
How are you handling I/O? If your program is crashing because you're piping lots of data into it, it is because you program is written incorrectly. Can you show us the program?

1. 1
2. 2
3. 3
frob
20
4. 4
Rutin
19
5. 5

• 32
• 13
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
632558
• Total Posts
3007075

×