Copyright (c) Hyperion Entertainment and contributors.
Path Name Handling
Revision as of 00:35, 23 March 2013 by Steven Solie (talk | contribs) (Created page with "= Description = When processing file names, it is often necessary to extract only a file name from a path or to generate an absolute path to a file. The dos.library contains ...")
Description
When processing file names, it is often necessary to extract only a file name from a path or to generate an absolute path to a file. The dos.library contains several routines designed to make this easier.
The FilePart() function takes a pointer to a file path and returns a pointer to the last part of the string (the part of the string that follows the last separator character, "/"). The last part of the string is normally a file or directory name.
STRPTR FilePart(STRPTR mypath);
In case mypath (from the prototype above) consists only of a file or directory name (like startup-sequence, s, or libs), FilePart() returns a pointer to the start of the string (a.k.a. the same value as mypath).