I know the meaning of argc and argv, but why argc=3 is required in many programs, the following is an example. #int main(int argc, char * argv[]) #{ #char chline[LINESIZE+1]; #const char * self=argv[0]; #const char * ipfile=argv[1]; #const char * opfile=argv[2]; #if ( ! (argc==3)) #{ #if (argc<3) #cout<#if (argc>3) #cout<
i*d
6 楼
Please help download a paper: "Exact analytical solutions of the stokes equation for testing the equations of mantle convection with a variable viscosity", Earth and Environmental Science, Vol 42, No. 7, Pg 537-545, 2006. My email: p*********[email protected] Many thanks!
【在 O***e 的大作中提到】 : I know the meaning of argc and argv, but why argc=3 is required in many : programs, the following is an example. : #int main(int argc, char * argv[]) : #{ : #char chline[LINESIZE+1]; : #const char * self=argv[0]; : #const char * ipfile=argv[1]; : #const char * opfile=argv[2]; : #if ( ! (argc==3)) : #{
【在 O***e 的大作中提到】 : I know the meaning of argc and argv, but why argc=3 is required in many : programs, the following is an example. : #int main(int argc, char * argv[]) : #{ : #char chline[LINESIZE+1]; : #const char * self=argv[0]; : #const char * ipfile=argv[1]; : #const char * opfile=argv[2]; : #if ( ! (argc==3)) : #{
k*y
14 楼
amyapple真好呀!
【在 a******e 的大作中提到】 : sent, check your email
j*y
15 楼
喔 那我看看就开奖了
【在 n*t 的大作中提到】 : 这个基本就是了。 : 她的票不够。 : 人家的过线了
z*u
16 楼
EE和CS中也有很多不同的方向
O*e
17 楼
argc 包含命令行选项的个数argv 包含aygc 个C 风格字符串代表了由空格分隔的命令 选项例如对于如下命令行 prog -d -o ofile data0 argc 被设置为5 I am sure I missed something, if you know, tell me and thanks!
【在 S*********g 的大作中提到】 : No, you don't know the meaning of argc.
a*e
18 楼
谢谢楼上的
a*l
19 楼
后知后觉啊。趁机赚利息。
r*m
20 楼
感觉方向不同差挺多的呀,不过感觉CS找工作容易写呀
r*t
21 楼
the code says ./self ipfile opfile so argc>=3. It is a bad UI design, though.
【在 O***e 的大作中提到】 : I know the meaning of argc and argv, but why argc=3 is required in many : programs, the following is an example. : #int main(int argc, char * argv[]) : #{ : #char chline[LINESIZE+1]; : #const char * self=argv[0]; : #const char * ipfile=argv[1]; : #const char * opfile=argv[2]; : #if ( ! (argc==3)) : #{
k*f
22 楼
argc includes the program name. So argv[0] is prog in your example. With that you have 5 command line parameters for your program. In your earlier post, the programs you encountered happened to use 3 additional parameters. There are plenty of programs using other number of parameters, too.
【在 O***e 的大作中提到】 : argc 包含命令行选项的个数argv 包含aygc 个C 风格字符串代表了由空格分隔的命令 : 选项例如对于如下命令行 : prog -d -o ofile data0 : argc 被设置为5 : I am sure I missed something, if you know, tell me and thanks!
O*e
23 楼
THanks replies very much, it help much and I roughly get it.
T*9
24 楼
不就是self ipfile opfile
【在 O***e 的大作中提到】 : I know the meaning of argc and argv, but why argc=3 is required in many : programs, the following is an example. : #int main(int argc, char * argv[]) : #{ : #char chline[LINESIZE+1]; : #const char * self=argv[0]; : #const char * ipfile=argv[1]; : #const char * opfile=argv[2]; : #if ( ! (argc==3)) : #{