argv的最大尺寸[1] ??? [英] Max Size of argv[1] ???

查看:111
本文介绍了argv的最大尺寸[1] ???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑:

int main(int argc,char * argv []){


}


在exec(2)中;谁传递给main的参数。


字符串的最大大小是什么。

argv [1] =" hello ..... ...." ;


argv [1]可以指出多长时间。即使我知道argv [i]是4个字节

指针。这个字符串可以有多长时间?


我只想发送一个50K的字符串作为我的进程参数(主要的'

args)

当我分叉和执行时。


有可能吗?标准是否对此有所说明?。


有没有限制?。

问候,

詹姆斯

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 ?.
Regards,
James

推荐答案

James< ja *********** @ yahoo.co.uk>写道:
James <ja***********@yahoo.co.uk> wrote:
考虑:
int main(int argc,char * argv []){
}
在exec(2);谁传递给主要的论据。
字符串的最大大小是多少。
argv [1] =" hello ........." ;
argv [1]指出多长时间。即使我知道argv [i]是4个字节的指针。这个字符串可以多长时间?
我只想发送一个50K字符串作为我的流程参数(主要的'
args)
当我fork和exec时。
有可能吗?标准是否对此有所说明?
有没有限制?。
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 ?.




据我所知,
$中没有要求它的大小b $ b C标准(我看不出标准

应该要求上限的任何理由)。另一方面,操作

系统可能会限制最大尺寸。例如。

POSIX标准SUSv3要求argv至少可以使用4096字节

(但许多Unices允许更多)。


问候,Jens

-

\ Jens Thoms Toerring ___ Je *********** @ physik.fu-berlin.de

\ __________________________ http://www.toerring.de


使用临时文件并发送文件名。

记住双方都应该关闭文件,因为文件句柄是参考

计算


" James" ; < JA *********** @ yahoo.co.uk> ????

新闻:2f ************************** @ posting.google.c om ??? ...
Use a temp file and send the filename.
Remember both side should close the file since the File handle is reference
counted

"James" <ja***********@yahoo.co.uk> ???
news:2f**************************@posting.google.c om ???...
考虑:
int main(int argc,char * argv []){

}
在exec中( 2);谁传递给main的参数。

字符串的最大大小是什么。
argv [1] =" hello ........." ;

argv [1]指出了多长时间。即使我知道argv [i]是4个字节的指针。这个字符串能用多长时间?

我只想发送一个50K字符串作为我的进程参数(主要的'
args)
当我fork和exec时。 br />
有可能吗?标准会对此说些什么吗?。

有没有限制?

问候,
詹姆斯
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 ?.
Regards,
James



- -

~Samba,不仅仅是一个低成本的文件和打印机服务器〜


- 让我们OpenSource -

- ---- =通过Newsfeeds.Com发布,未经审查的Usenet新闻= -----
http://www.newsfeeds.com - 世界排名第一的新闻组服务!

----- ==超过100,000个新闻组--19个不同的服务器! = -----


--
~ Samba, more than a low cost File and Printer server ~

-- Let us OpenSource --
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Je***********@physik.fu-berlin.de 在留言中写道:< 2p ************ @ uni-berlin.de> ; ...
Je***********@physik.fu-berlin.de wrote in message news:<2p************@uni-berlin.de>...
James< ja *********** @ yahoo.co.uk>写道:
James <ja***********@yahoo.co.uk> wrote:
考虑:
int main(int argc,char * argv []){
consider :
int main (int argc, char * argv [ ]) {


}


在exec(2)中;谁传递给main的参数。
In exec (2) ; Whose arguments which are passed to main.


字符串的最大大小是什么。
argv [1] =" hello ..... ...." ;
What is the maximum size of the string.
argv[1] = "hello........." ;


argv [1]指出多长时间。即使我知道argv [i]是4个字节的指针。这个字符串可以有多长时间?
How long can argv[1] point to. even though i know argv[i] is 4 bytes
pointer. How long can the string be ?.


我只想发送一个50K的字符串作为我的进程参数(main''s
args)
当我分叉和执行时。
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 ?.


有没有限制?。



据我所知,那里在C标准中没有要求它的大小(我看不出标准为什么要求上限的任何理由)。另一方面,操作系统可能会限制最大尺寸。例如。
POSIX标准SUSv3要求argv至少可以使用4096字节
(但许多Unices允许更多)。

问候,Jens



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




单个参数的长度没有限制,仅限于

整个参数行的长度具有ARG_MAX限制

,在limits.h中定义。以下是各种系统中ARG_MAX大小的有趣比较:

http://rhols66.adsl.netsonic.fi/era/unix/arg-max.html


问候,

马克。



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:

http://rhols66.adsl.netsonic.fi/era/unix/arg-max.html

Regards,
Mark.


这篇关于argv的最大尺寸[1] ???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆