I want to read a txt file line by line. I am getting the error"the device is not ready". I can't understand what the problem is? The code is as follows:
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char **argv)
{
char command[100];
char line[10];
FILE* fp = fopen("input.txt","r");
while (fgets(line, sizeof line, fp) != NULL)
{
puts(line);
}
getchar();
return 0;
}
Can anybody tell me what mistake I am doing? Thanks in advance. operating sys : windows 7; compiler : dev c++