Page 1 of 1

How to read two fields in a file

Posted: Sun Feb 01, 2009 4:18 pm
by g_p
Hello i would like to read from a file.txt the fields it contains

e.g.
John teacher
George doctor
Maria lawer

I have to read two strings which are seperated by a " " space.

May you please tell me, how can i open and read the file?

Thanks

Re: How to read two fields in a file

Posted: Sun Feb 01, 2009 4:43 pm
by requinix
fopen to open the file, fread to read from the file, and fclose to close the file.