Peter Jay Salzman <[EMAIL PROTECTED]> writes:
> Right now, i need to get user input (stdin) or file input (FILE *) and
> put it into a char *. than copy the char * to a GString.
>
> It would be swell if I could do this in one atomic operation rather than
> the char * middleman, which may involve size checking and mallocing.
With glib 2.0 you could use g_string_set_size() to reserve a block of
memory that you can read into. E.g., use
g_string_set_size (str, str->len + BLOCK_SIZE)
to make sure that there is a block of size BLOCK_SIZE at the end of
the string that you can use. Then read into the memory pointed to by
str->str + str->len - BLOCK_SIZE.
_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list