Re: Best way to copy a GString object



Hi,

Michael Torrie <torriem chem byu edu> writes:

> What is the best way to copy a GString object in glib (plain c)?  There
> doesn't seem to be any copy constructor.  My current guess is to use
> g_string_new_len(src->str,src-len).  However that won't put in a
> terminating null character which I'd like to have so it will be easier
> to manipulate this string later.

Read the docs again or, even better, take a look at the source.
g_string_new_len() will of course NULL-terminate the string for you.


Sven



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