fgets() doesn't know the difference between characters, such as 'a', 'b', 'c' ... and numbers such as '1', '2', '3' ... '9'. In the file they are all just text. If you want to treat all those numbers as text, read the file line by line, then just use fgets() the normal way
char line[80]
FILE* fp = fopen("data.inp","r");
while(fgets(line,1,sizeof(line),fp)
{
// do something
}
fclose(fp);
If you just want to add more lines to that file, then it isn't necessary to read it at all. Open the file for append and start writing -- new lines will be appended to the end of the existing lines.
Last edited by Ancient Dragon; Feb 5th, 2007 at 9:38 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.