[9342] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: file selection dialog
daemon@ATHENA.MIT.EDU (Brandon Long)
Thu Oct 15 19:22:48 1998
Date: Thu, 15 Oct 1998 16:22:03 -0700
From: Brandon Long <blong@fiction.net>
To: gtk-list@redhat.com
Reply-To: blong@fiction.net
Mail-Followup-To: gtk-list@redhat.com
In-Reply-To: <Pine.LNX.3.96LJ1.1b7.981016053544.2090e-100000@ume.pht.co.jp>; from Scott Stone on Fri, Oct 16, 1998 at 05:36:23AM +0900
Resent-From: gtk-list@redhat.com
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/
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null