Re: g_realloc (OFF-TOPIC) (part 2)



Alexandre Fayolle escribió:

On Thu, 26 Oct 2000 learfox furry ao net wrote:

If yer loading line by line from a text file you can realloc() in 128
byte chunkcs if you know each line will be about 80 bytes or less.


Actually, if you're reading from a text file, you might as well use a
stat() system call to get the size of the file first and allocate the
buffer afterwards.

--
Alexandre Fayolle
http://www.logilab.com
LOGILAB, Paris (France).

Hi ,
It is not the problem. My app caths data asyncronously and the number of
data
can be 1000 or a million. I think that to double the size of the array
each time I need to
 realloc is a good idea.
Thank you very much for your help
    Eusebio.

--
"I've seen things you people wouldn't believe...
Attack Ships on fire off the shores of Orion.
I've watched C-beams glitter in the dark off of Tanhauser Gate.
All those moments will be lost in time...like tears, in rain.
Time to die." -- Roy Batty







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