Re: Short form of __FILE__
- From: "pemo" <usenetmeister@xxxxxxxxx>
- Date: Mon, 6 Feb 2006 15:44:42 -0000
"Lukas Ruf" <ruf@xxxxxxxxx> wrote in message
news:slrndueqqb.blc.ruf@xxxxxxxxxxxxxxxxxx
Dear all,
for debugging purposes, I like the pre-compiler macros
__FILE__, __FUNCTION__, __LINE__
I have been wondering if there is a short form of __FILE__ that
provides only the filename without path.
I am using gcc as available in Debian unstable:
gcc (GCC) 4.0.3 20060128 (prerelease) (Debian 4.0.2-8)
Reading the info pages on gcc has not revealed what I am looking
for. Hence my question....
__FILE__ contains whatever path is given to the compiler.
consider a simple 'test.c' ...
#include <stdio.h>
int main(void){puts(__FILE__); return 0;}
If you compile test.c like this: gcc -E test.c
You will see __FILE__ is "test.c".
If you compile it like this gcc -E ./test.c
You will see __FILE__ is "./test.c".
--
==============
*Not a pedant*
==============
.
- Follow-Ups:
- Re: Short form of __FILE__
- From: Lukas Ruf
- Re: Short form of __FILE__
- References:
- Short form of __FILE__
- From: Lukas Ruf
- Short form of __FILE__
- Prev by Date: Short form of __FILE__
- Next by Date: Re: why standard files?
- Previous by thread: Short form of __FILE__
- Next by thread: Re: Short form of __FILE__
- Index(es):
Relevant Pages
|