Pause c program with input redirection -
i wrote following simple code in c , used input redirection batch file. how can pause program inside while loop?
#include <stdio.h> int main(void) { char buffer[2048]; while ( !feof(stdin) ) { gets( buffer ); printf( "%s", buffer ); //i want pause program here, until press enter } return 0; } the batch file is: main.exe < input.txt >output.txt
thanks in advance!
#include <stdio.h> #include <conio.h> int main(void){ char buffer[2048]; while ( !feof(stdin) ) { gets( buffer ); printf("%s", buffer ); while(!_kbhit()); _putch('\n'); while(_kbhit()) _getch(); } return 0; }
Comments
Post a Comment