vippstar@gmail. com wrote:
CBFalconer <cbfalco...@yah oo.comwrote:
>
>
>>
>Or, simpler, get ggets(), which is fully portable and written in
>purely standard C. Available in source form at:
>>
> <http://cbfalconer.home .att.net/download/>
>Or, simpler, get ggets(), which is fully portable and written in
>purely standard C. Available in source form at:
>>
> <http://cbfalconer.home .att.net/download/>
Reading the code in ggets.c I noticed that if you run out of memory
the byte read from the stream is dropped (lost). I suggest you use
ungetc() to push it back to the stream. Also, changing ix and cursize
to size_t wouldn't do any harm but good. (you can drop the casts in
realloc, and you'll be able to claim it's in standard C, since files
might have lines more than INT_MAX bytes long)
requires exactly an int. I did put it in public domain, so go
ahead and make the changes. I have some doubts about the ungetc,
since once memory is no longer available it is possible that ungetc
no longer works.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
** Posted from http://www.teranews.com **
Leave a comment: