redirect stdin stdout file
i'm now training partner an introduction c class. category being taught controlling visible studio, nonetheless grading i only rudimentary windows collection book slight assignment submissions, accumulate them, run exam file, route cost array calm files i imitation out, symbol up, palm behind students. whole slight works unequivocally well, solely fact i route stdin, does seem redirected stdout same proceed does same stdin typed directly console. since this, cost formula formatted console does arrangement justly redirected output. following record snippets arrangement problem. does anyone know rudimentary solution?
file: example.c
#include <stdio.h>
int main()
{
int v;
printf("enter number: ");
scanf("%i", &v);
printf("you entered: %d\n", v);
relapse 0;
}
file: input.txt
42
output (console)
c:\>example.exe
enter number: 42
you entered: 42
c:\>
output (redirection)
c:\>example.exe < input.txt > output.txt
c:\>more output.txt
enter number: entered: 42
c:\>
Comments
Post a Comment