int FLdirName (const char Fname[], char Bname[])


Return all but the last component of a file path


This routine takes a file path specification and returns all but the right-most component of the file name. Components are separated by "/" characters. If no "/" character appears in the name, an empty string is returned. For Windows, the directory separator character is "\".


   "abc/def"      => "abc"
   "abc/def/"     => "abc/def"
   "abc/bcd/def"  => "abc/bcd"
   "/abc/def"     => "/abc"
   "/abc/bcd/def" => "/abc/bcd"
   "./def"        => "."
   "def"          => ""
Special cases:
   "/def"         => "/"
   "/"            => "/"


<- int FLdirName
Number of characters in the output string
-> const char Fname[]
Input character string with the path name
<- char Bname[]
Output string with the all but the last path name component. This string at most FILENAME_MAX characters long including the terminating null character.

Author / revision

P. Kabal / Revision 1.22 2003/05/09

See Also

FLbaseName, FLdefName, FLexpHome

Main Index libtsp