Re: sub string



On Tue, Jul 10, 2001 at 09:53:19AM -0500, defcon5 ec-red com wrote:
Hi

I have in the variable  gchar *aux = "name_of_directory/name_of_file";
I want to copy only the substring /name_of_file to another gchar ...
how can i do that??
with strtok??

You can do it with strtok or what I use is rindex: 

strcpy( new_string, rindex( aux, '/' ));

is one way to do it.  This is pure C though, I don't know if there is a gtk*
way of doing it :)

Regards,

Alan

--
Arcterex <arcterex userfriendly org>   -==-   http://arcterex.net
"I used to herd dairy cows. Now I herd lusers. Apart from the isolation, I
think I preferred the cows. They were better conversation, easier to milk, and
if they annoyed me enough, I could shoot them and eat them." -Rodger Donaldson




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