#include "stdio.h"
int main(){
char str[20];
while(scanf("%19[^\n]",str)==1){
printf("%s",str);
}
return 0;
}
Compiled using:
$ gcc file.c -o file
$ file < input.txt
The program is reading only first line from the file input.txt
:
hello this is
a test that
should make it
happen
I want the program to read the complete file, please help