Jump to content
  • Advertisement
Sign in to follow this  
Aqua Costa

Limit of parameters in command line?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!