为什么我的这个命令行参数程序不能读取
下面是我改动了一点书中的程序,虽然能进入黑窗口,但是不能读写。为什么?
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
int main(int argc, char *argv[])
{
int i, times;
times = atoi(argv[1]);
if(argc<2 || times<1)//书上是把上面的一行并到这一行这样写的if(argc<2 ||( times=atoi(argv[1]))<1)
{
printf("Usage: %s positive-number\n", argv[0]);
}
else
{
for(i=0; i<times; i++)
{
puts("Hello, good looking!");
}
}
return 0;
}