Re: dealing with utf8 filenames



On Wed, 2006-02-22 at 10:47, Christian Neumair wrote:
For the sake of readability, I'd rather use the following code:

char **str;

/* str[0]: basename
   str[1]: extension */
str = g_strsplit (filename, ".", 2);

g_strfreev(str)

Surely that won't work if there is more than one dot in the name!

Why? :)

Because the file "myprog-1.2.3.tar.gz" will be split into:
basename="myprog-1" and extension="2.3.tar.gz", which is incorrect for a
file name and incorrect for an extension.





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