Re: how to read a file, line by line, into a GString?



Peter Jay Salzman <p dirac org> writes:
this is cool.  i first learned of glib from your book.  :)   even if glib had
nothing else but GStrings, it would be one of the most useful libraries...

i'd rather first try solutions from the stable version of glib, since other
people will be compiling this besides me.  i'd rather not have "upgrading to
debian sid" a requirement for compiling this thing.

I don't mean use the new GLib. I meant copy the code from there which
does what you want. get_contents_stdio() is the static function.

I guess it does use an intermediate buffer, but just a small static
one, so you don't have any inconvenience from it. Should work OK with
1.2 with small modifications.

Hmm, giochannel.c does exactly what you want, no intermediate buffer,
for the g_io_channel_fill_buffer static function. But that code really
does rely on the new GString I think.

Havoc




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