如何对main(int argc , char *argv)输入参数来调试程序?codeblocks vc
怎么对main(int argc , char *argv)输入参数来调试程序??codeblocks vc
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *agrv[])
{int i ;
//int i=0;
for(i=0;i<argc;i++)
printf("%s\n",agrv[i]);
// printf("test main()\n");
if (3 == argc)
{
printf("argc = 3, agrv[0] = %s\n", agrv[0]);
}
else
{
printf("argc = %d\n", argc);
}
system("pause");
}
我只会 vc6 里面可以通过 project -setting -debug -program arguments
来输入main函数输入的参数..
不知道在调试的时候,,debug,,如何来设置参数导入到函数中,,进行调试..
------解决方案--------------------
属性->调试->命令参数 里面添加相应参数
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *agrv[])
{int i ;
//int i=0;
for(i=0;i<argc;i++)
printf("%s\n",agrv[i]);
// printf("test main()\n");
if (3 == argc)
{
printf("argc = 3, agrv[0] = %s\n", agrv[0]);
}
else
{
printf("argc = %d\n", argc);
}
system("pause");
}
我只会 vc6 里面可以通过 project -setting -debug -program arguments
来输入main函数输入的参数..
不知道在调试的时候,,debug,,如何来设置参数导入到函数中,,进行调试..
------解决方案--------------------
属性->调试->命令参数 里面添加相应参数