01-23-04 10:21 PM
Maurizio Loreti wrote:quote:
> You may homebrew your own; "getenv" to get the environment variable,
> "strtok" to get every component, "access" to test for the file.
I *did* say, in the sentence right after the one you quoted, that I've
just finished writing my own. The point is, though it's easy to write
it's not so easy to be sure you have a robust, portable implementation
till a few years and platforms have gone by and a few bugs found. There
are special cases involving empty path entries (":" appearing at
beginning or end, or consecutively) and potential issues with symlinks
and permissions and special files and NFS and ....
By analogy: I could write my own getcwd() function. It's not hard, in
concept. In practice it's much better to use a standard, well-tested,
builtin function. That's why we have libraries.
MB
[ Post a follow-up to this message ]
|