Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Max Size of argv[1] ???

Reply
Thread Tools

Max Size of argv[1] ???

 
 
Benjamin Ketcham
Guest
Posts: n/a
 
      09-03-2004
Richard Tobin <(E-Mail Removed)> wrote:
> In article <ch5p44$c1l$(E-Mail Removed)>,
> Kenny McCormack <(E-Mail Removed)> wrote:
>
>>>How exactly would you present a 50K argument to your program?

>
>>The short answer is: ls *

>
> That presents lots of smallish arguments, which isn't exactly what the OP
> was asking about. I think a single 50k argument would be very unusual.


Unusual, yes. A sign of bad programming/planning, probably.
Always avoidable in any real-world case, probably.
But, still:

awk "`cat big_awk_program`"

Yes yes, "-f" would be better! And the equivalent of "-f" would
probably be a better solution for the OP: the size limits of the
filesystem are likely to be much larger than the limits of the
commandline (and environment variables).

--Benjamin

 
Reply With Quote
 
 
 
 
Mark R.Bannister
Guest
Posts: n/a
 
      09-03-2004
Jack Klein <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>. ..
> On 1 Sep 2004 09:02:41 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (Mark R.Bannister)
> wrote in comp.lang.c:
>
> > http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de wrote in message news:<(E-Mail Removed)>...
> > > James <(E-Mail Removed)> wrote:
> > > > consider :
> > > > int main (int argc, char * argv [ ]) {

>
> > > > }

>
> > > > In exec (2) ; Whose arguments which are passed to main.

>
> > > > What is the maximum size of the string.
> > > > argv[1] = "hello........." ;

>
> > > > How long can argv[1] point to. even though i know argv[i] is 4 bytes
> > > > pointer. How long can the string be ?.

>
> > > > I just want to send a 50K string as my process arguments (main's
> > > > args)
> > > > when i fork and exec.

>
> > > > Is it possible ?. Does standard say something on this ?.

>
> > > > Are there any limitations ?.
> > >
> > > As far as I can tell, there's no requirement for the size of it in
> > > the C standard (and I can't see any good reason why the standard
> > > should require an upper limit). On the other hand, the operating
> > > system will probably put a limit on the maximum size. E.g. the
> > > POSIX standard SUSv3 requires that argv can use at least 4096 bytes
> > > (but many Unices allow a lot more).
> > >
> > > Regards, Jens

> >
> > There isn't a limit on the length of an individual argument, only on
> > the length of the entire argument line has the ARG_MAX limit imposed
> > on it, defined in limits.h. The following makes an interesting
> > comparison on the size of ARG_MAX across various systems:

>
> Perhaps you thought you were responding in comp.unix.programmer, and
> not comp.lang.c. According to the C standard, a conforming compiler
> is not allowed to define a macro in <limits.h>.
>
> C language only, not POSIX here, please.


Well excuse me for giving a real world answer.
 
Reply With Quote
 
 
 
 
Kenny McCormack
Guest
Posts: n/a
 
      09-03-2004
In article <(E-Mail Removed)> ,
Mark R.Bannister <(E-Mail Removed)> wrote:
....
>Well excuse me for giving a real world answer.


The real world is OT here. I thought you understood that by now.

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      09-03-2004
(E-Mail Removed) (Mark R.Bannister) writes:
> Jack Klein <(E-Mail Removed)> wrote in message
> news:<(E-Mail Removed)>. ..

[...]
> > Perhaps you thought you were responding in comp.unix.programmer, and
> > not comp.lang.c. According to the C standard, a conforming compiler
> > is not allowed to define a macro in <limits.h>.
> >
> > C language only, not POSIX here, please.

>
> Well excuse me for giving a real world answer.


Which real world would that be? There are plenty of real world
systems that support C but not POSIX, and there are newsgroups where
POSIX is topical.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
azad2010 azad2010 is offline
Junior Member
Join Date: May 2012
Posts: 1
 
      05-05-2012
Hi
Do u have any solution to solve your problem?
I want to send one argument to c app but length of it is 480 characters and app dose not work
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
want max width and max height as long as not exceed 100px Summercool HTML 9 10-23-2007 02:27 AM
ADSL Max/Max Gordy NZ Computing 6 11-24-2006 11:41 PM
Textarea max rows and max characters per row Greg Ferris Javascript 2 01-16-2004 07:21 PM
Max Apperture and Max. Shutter Speed Confusion-HELP bhaskar Digital Photography 12 07-22-2003 05:17 PM



Advertisments