Maximum combined length of command line arguments in c++

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 2K views
mdamul
Messages
3
Reaction score
0
In a c language, what is the maximum combined length of command line arguments
including the space between adjacent arguments.?
 
Physics news on Phys.org
I don't think command line argument restrictions have anything to do with what code an app is written in, it's an O.S. characteristic and is likely to vary among Windows / MAC OS / UNIX.

I think, years ago, there was a DOS and early-windows restriction of 256 characters but I don't know that that still holds in windows.
 
The limit depends on the operating system and the command shell you are using, not on the C language.

On Windows XP, Vista, and Windows 7 it is 8191 characters.
On some Unix systems it is much bigger, with limits like 65536 or even 262144 characters.

Look for the constant ARG_MAX in your C ibrary header files.