Trying to scan in user input after the '<' not working on gcc.
I am reading in a csv file, outputting a txt file and also reading in a text file to search for the keys that I have to output into the txt file.
So basically this is my code.
/* This is to read in the CSV file" */
Code:
while(fscanf(Data_input,"%d; %[^\n]",&weight,num) == 2){
insert(ptr,word,num);
}
/*Now I want to read in the search key where read_word is declared as char array of size 500*/
Code:
while(scanf("%[^\n]", read_word) == 1){
printf("%s\n", read_word);
}
The command on stdin should look like this after compilation
./aout read.csv out.txt < search.txt
I am unable to read the search.txt. I tried using fscanf and now I am trying to use just scanf to see if anything happens but the command reads out null as there is no such this that exists on argv[4]? I know its not reading in the file since when I print it out it prints null and exits =(