Since dos compilers (like MS and borland ones) all have the call which
does the fnsplit (it's actually an int 0x21 call I believe, hance easy to
implement), I'd say they chose to put it in DJGPP as well. Under unix,
there is no real equivalency to this due to the different file system
structure. To get the blah in /usr/local/bin/blah, you can do a
char *path_without_filename = path;
char *just_filename = strrchr(path, '/');
*just_filename++ = '\0';
This will leave you with "/usr/local/bin" (without trailing slash) in
path_without_filename, and "blah" in filename.
Hope I've helped.
Pete
On Thu, 28 May 1998, Joseph Martin wrote:
> Hello,
> I used DJGPP for DOS a while back which is a port of GCC to DOS.
> Since it was a port I assumed all functions would be common between GCC
> and DJGPP. However, I used a function in DOS called fnsplit, defined in
> dir.h, that would take a string and parse it into drive, path, and
> filename. I looked, but can't find it under GCC. Does anyone know of an
> equivalent function or algorithm I can use?
>
> Thanks,
>
> Joseph Martin
> [EMAIL PROTECTED]
> Linux newbie/sysadmin ( dangerous combo! ;-> )
>
Pete Ryland Home phone: +61 2 9697 9262 Mobile: 014 035 802
email: [EMAIL PROTECTED] ICQ UIN: 4256333
WWW: http://www.pdr.ml.org ftp: ftp.pdr.ml.org