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

Re: [MiNT] Getline



Hi Mark,

I am not a Mint programmer and don't know anything about
getline so I hope I am not insulting your intelligence but
sometimes errors like this occur when reading files
with cr/lf instead of unix line endings.

Just a thought.


Regards,

Peter

On Sun, 24 Oct 2004 16:40:26 -0400, Mark Duckworth <mduckworth@atari-source.com> wrote:
>
> 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
>
>
>
>




________________________________________________________________________
FREE local-rate dial-up - no monthly fees!  Move over to Freeola for
FREE unlimited web space, e-mail & domain hosting www.freeola.com