cmd 标准输入输出
today i realized that '>' and '<' in command line (cmd) we can output or input data . so can we test the program . as the example bellow : there fies : test.c in.txt out.txt test.c:
#include <stdio.h>
int main()
{
int a ;
scanf("%d",&a) ;
printf("%d\n",a+1) ;
return 0 ;
}
in.txt :
1000
out.txt (nothing)
compile the test.c in the command line like this :
gcc test.c
then a.exe generated . the last thing to do is , typein the command :
a.exe <in.txt >out.txt
when it finished , you can see the result in out.txt .
1001
in the vc++6.0 , you can create the input file in the project folder , setting as project -> project setting -> debug -> debug arguement , add
<in.txt