Re: [gtk-list] Re: file selection dialog
- From: Brandon Long <blong fiction net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: file selection dialog
- Date: Thu, 15 Oct 1998 16:22:03 -0700
On 10/16/98 Scott Stone uttered the following other thing:
> On Thu, 15 Oct 1998 padraig@turing.idc.ul.ie wrote:
>
> >
> > hi,
> >
> > when you collect the filename from the file selection dialog using
> >
> > filename = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fs) );
> >
> > it returns the full path of the filename. my question is: is there any
> > quick way to get just the filename (i.e. without the path) or do you
> > have to extract it (from the longer string) yourself?
>
> It's easy, just:
>
> char *s1=rindex(filename,'/');
> s1++;
>
> now, s1 is your base filename, without the path.
is rindex deprecated? If so, strrchr would be a better bet:
char *s1 = strrchr (filename, '/');
if (s1)
{
filename = s1 + 1;
}
Brandon
--
Brandon Long "... a boy who gets a 'C-minus' in
MD6 Crash Test Dummy Appreciation of Televison can't be all bad."
Intel Corporation -- Robert Heinlein, _Starship Troopers_
I'm too low on the totem pole to speak for Intel.
http://www.fiction.net/blong/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]