Preprocessor __FILE__ for Debugging

Thread Tools Search this Thread
Top Forums Programming Preprocessor __FILE__ for Debugging
# 1  
Old 09-21-2011
Preprocessor __FILE__ for Debugging


Just wondering if it is possible to trim the file path output by __FILE__ preprocessor in my debugging line.

Let's say my main.cpp file is found in C:\User\MyName\SystemA\Mod1\SubMod2\Test\main.cpp

for __FILE__, I just want the filename - main.cpp to be printed, instead of the entire path + filename.
# 2  
Old 09-21-2011
# 3  
Old 09-21-2011
That won't work inside C, frank_rizzo.

There's not another predefined variable for the name minus path, but you can 'cheat' by altering it with a #line directive:

#line 1 "filename.c"
// rest of file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Use #if not defined with OR boolean logic in preprocessor directives

I am currently using Linux CentOS and programming in FORTRAN 90 using Portland 7.1 compiler. I am able to set in the preprocessor directives a flag called TEST. when I go to use logic in my code i can write #ifdef TEST execute something #endif Furthermore, if I want to negate the... (2 Replies)
Discussion started by: prodigious8
2 Replies

2. Programming

c++ debugging

hey i have a problem with a switch case in program and the debugger is messy has hell ( we use normal VI and gdb in our schoool to make it more diffiacult) any way i have a problom where for some unknown reason the debugger just skips a switch statment as if it wasent even there the rest... (2 Replies)
Discussion started by: gotenxds
2 Replies

3. Programming

enum and C preprocessor

Say I have a list of enumerations I wish to use to select a variable at compile-time: enum pins { PIN_A=1, PIN_B=7, PIN_C=6, } int VAR1, VAR2, VAR3, VAR4, VAR5, VAR6, VAR7; #define PIN_TO_VAR(NUM) VAR ## NUM int main(void) { PIN_TO_VAR(PIN_A)=32;... (2 Replies)
Discussion started by: Corona688
2 Replies

4. UNIX for Dummies Questions & Answers

blcr debugging

hey, can any one please tell me how can i debug blcr?? actually i have checkpointd a client using blcr and i want to check out what actually happens when we checkpoint any program. so i want to see what happen when we type $cr_checkpoint pid i mean i want to debug when i enter this... (0 Replies)
Discussion started by: pratibha
0 Replies

5. Homework & Coursework Questions

Fixer Debugging

School:Syrian Virtual University - Bachelor in Information Technology - Tutor: A.Issa - course: S10-iti320 hi all, would you please help me correcting and debugging this script: which accepts a list of users as argument resiting those files permissions: say our directory... (0 Replies)
Discussion started by: erzal
0 Replies

6. Shell Programming and Scripting

Fixer Debugging

hi all, would you please help me correcting and debugging this script: which accepts a list of users as argument resiting those files permissions: say our directory structure: /home/erzal/file /home/erzal/dire /home/erzal/share /home/erzal/share/file /home/erzal/share/dire 1-... (1 Reply)
Discussion started by: erzal
1 Replies

7. Programming

Need some help in debugging the C-Progam.

Hi i want to debug the C program with GDB debugger. I want to debug the program by line by line. I want to debug program like as we debug the program in Turbo-C using the F8. Can any one help me? I know i have to use single stepping. But i don't know how to use it. Any help can be appreciated..... (5 Replies)
Discussion started by: ps_sach
5 Replies

8. Programming


Hi, Anyone please explain the functionality of ## in c. I didn't get the following preprocessor directives, # define LL(x) x ## LL # define LL(x) x ## i64 Thanks, Naga:cool: (1 Reply)
Discussion started by: Nagapandi
1 Replies

9. Solaris


when I tried to debug my application i got the following. gdb -v GNU gdb 6.6 file is in C and Xmotiff Languages (gdb) attach 25499 Attaching to process 25499 Retry #1: Retry #2: Retry #3: Retry #4: 0xfea40b68 in ?? () (gdb) where #0 0xfea40b68 in ?? () (0 Replies)
Discussion started by: satish@123
0 Replies

10. Shell Programming and Scripting

Regarding Debugging

Hi, If we want to debug a shell script, then set -vx has to be included in the begining of the script. Just i want to know what purpose -vx is used. Thanks in advace Sarwan (2 Replies)
Discussion started by: sarwan
2 Replies
Login or Register to Ask a Question