I am using Visual Studio 2010 Pro for simple C programming, I would like to know how I can provide input to the program without having to manually do so. The enviroment I am used to working is your standard commandline Unix enviroment. Once I compile a C file call "inputsInts" it becomes "a.out" and to test input I would type:
The easy way
echo 1 2 3 4| ./a.out //to provide input The number of ints input was 4 //output
The easier way
more input.txt| ./a.out //to provide input The number of ints input was 4 //output
The tedious way
./a.out //now I would manually type 1 2 3 4 s //in this case I have to type a letter to move on The number of ints input was 4 //output
Hard is how I have to do it in Visual Studio 2010. I would like to be able to just input in an area the input ahead of time or at least have it read a text file. Obviously I can't test large sets of data by manually typing it in. At the moment I am just doing the coding in VS2010 and going to the unix enviroment to do most testing. I would like to stay in the VS2010 enviroment until I am ready to do a final test in Unix.
I have altered the question quite a bit since I first posted, so the original answers may seem off a bit. Again I appretiate everyone's time and help.
This is just the simple code for an example: #include
int main () {
int x, n = 0;
while (scanf("%d", &x)==1)
n++;
printf("The number of ints input was %d\n", n);
return(0);
}