Maximum combined length of command line arguments in c++

Click For Summary

Discussion Overview

The discussion revolves around the maximum combined length of command line arguments in C and C++ programming, focusing on how this limit varies based on the operating system and command shell used.

Discussion Character

  • Technical explanation, Debate/contested

Main Points Raised

  • One participant inquires about the maximum combined length of command line arguments, including spaces.
  • Another participant argues that command line argument restrictions are determined by the operating system rather than the programming language, suggesting that historical limits in DOS and early Windows may not apply today.
  • A later reply clarifies that the limit varies by operating system, stating specific character limits for Windows and Unix systems, and references the constant ARG_MAX in C library header files.
  • One participant expresses confusion regarding the topic.

Areas of Agreement / Disagreement

Participants generally agree that the limits are OS-dependent, but there is no consensus on the specific values or whether older restrictions still apply.

Contextual Notes

Participants mention varying limits across different operating systems, indicating that the discussion may be limited by the specific environments being referenced.

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.?
 
Technology 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.
 
i cannot understand
 
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.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
14
Views
4K
  • · Replies 118 ·
4
Replies
118
Views
10K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
89
Views
7K
Replies
1
Views
2K