int main(int argc, char** argv)
{
int i
for(i=0 i<argc i++)
printf("%s\n", argv[i])
return 0
}
比方这个程序叫 main.c 吧,先编译成 main.exe
gcc main.c -o main.exe
然后用命令运行
main.exe aefae 2423 asdae
程序输出:
main.exe
aefae
2423
asdae
argv 是通过命令行传送给程序的参数的字符串指针数组,argc 是参数的个数
int iRetCodechar sStr[100]
sprintf(sStr,"home/test/upload/unload.sh")
iRetCode=system(sStr)
if(iRetCode<0)
{
printf("shell error!")
}