Best way to copy a GString object



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.  g_string_new() seems to be what I
need, except that I can't guarantee that the input GString will have a
terminating null in it.

Michael

-- 
Michael Torrie <torriem chem byu edu>



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