[9348] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: file selection dialog
daemon@ATHENA.MIT.EDU (Jason A. Pfeil)
Fri Oct 16 09:42:55 1998
Date: Fri, 16 Oct 1998 09:41:55 -0400 (EDT)
From: "Jason A. Pfeil" <pfeil@nu.cs.fsu.edu>
To: Brandon Long <blong@fiction.net>
cc: gtk-list@redhat.com, recipient list not shown: ;
In-Reply-To: <19981015162203.E24819@shell9.ba.best.com>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
On Thu, 15 Oct 1998, Brandon Long wrote:
> 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:
strrchr is standard C anyway, and that's always a better choice.
>
> 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
>
>
-------------------------------------------------------------------------------
Jason A. Pfeil, Computer Science Graduate Student 101 Carothers Hall
http://www.cs.fsu.edu/~pfeil C3527 University Center
pfeil@cs.fsu.edu (850)644-8014
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null