I have a problem that i found is fscanf(FD,"%s %s %s %s %s %s", OriAirport, DesAirport, FlightNumber, AircraftType, DepTime, ArrTime); it not reading from the txt.file and not printing the error for opening the file. Is some where it went wrong.
I have a side question. I've found that reading/writing to text files is much easier using the C I/O - fscanf, fprintf etc. Can anybody give me a good reason to use C++ I/O (umm I think ifstream, ofstream) over the C I/O? It might just be that I was using the C++ I/O in an inefficient way - it just seemed like I had to write a lot more code to get the job done.
As for the original question. I can't see anything wrong with your code. Can you please post a sample of the file you are trying to read?
@NickPaul
C++ streams are type safe, flexible and extensible
eg: you can't use printf with a custom type but in C++ you can overload the ostream << operator