[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Getline



Hello everyone,

I'm writing the new Sparemint Update Manager software.  One of the
things this software must do is read in a package database which it does
one line at a time. 

For some reason, getline is producing very inconsistent results.

I am using it as such:

while ((getline(&line, &len, fp))!=-1)
{
	// Do actions
	count++;
}

now the file that it's reading is 358 lines long.

Sometimes it will read 242 lines of this file.  Other times 301 lines of
this file.  I have verified the value getline is returning is indeed -1
for some reason before the end of the file which also indicates error.
But what error could I be getting?  Regardless I simply cannot get it to
read the entire file!  I'm not precisely sure what I'm doing wrong.  Any
ideas?

Thanks,
Mark