Re: Best way to copy a GString object
- From: Sven Neumann <sven gimp org>
- To: Michael Torrie <torriem chem byu edu>
- Cc: gtk-list gnome org
- Subject: Re: Best way to copy a GString object
- Date: 06 Jul 2004 01:30:25 +0200
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.
] [Thread Prev