Is there a macro to get the basename and dirname of __FILE__?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

__FILE__ is the full path of the file used at compile time.

$ cat a/test.c
#include <stdio.h>
int main() {
	puts(__FILE__);
	return 0;
}
$ gcc a/test.c
$ ./a.out
a/test.c

The following discussion says there is no way to get its basename and
dirname at compile time. Is it still the case?

Could <string.h> functions be used at compile time for __FILE__ since
__FILE__ is known at compile time anyway? Thanks.

https://stackoverflow.com/questions/8487986/file-macro-shows-full-path

-- 
Regards,
Peng



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux