November 15, 2004 __FILE__ macro | ||||
---|---|---|---|---|
| ||||
I am using the __FILE__ macro but am having problems. Sometimes the macro is replaced by the file name, File.cc, both other times it is replaced by the whole path name like /home/dev/test/File.cc. How can I prevent the whole path name from printing? |
November 15, 2004 Re: __FILE__ macro | ||||
---|---|---|---|---|
| ||||
Posted in reply to Karyn Chen | Karyn Chen wrote:
> I am using the __FILE__ macro but am having problems. Sometimes the macro is
> replaced by the file name, File.cc, both other times it is replaced by the whole
> path name like /home/dev/test/File.cc. How can I prevent the whole path name
> from printing?
It depends on the file name passed to the compiler. If the command line contains "File.cc", then __FILE__ will be "File.cc". OTOH, if you pass a path on the command line, the path version is what you get.
Search google for a function called "basename".
|
Copyright © 1999-2021 by the D Language Foundation