filename extraction from __FILE__

Hi
after some searches I have found that from the FILE macro it is possible to extract the filename using the following trick

#define FILENAME (strrchr(FILE, '\') ? strrchr(FILE, '\') + 1 : FILE)

and it works!

Is there anyone out there so kind to explain the magic behind "(strrchr(FILE, '\') ? strrchr(FILE, '\') + 1 : FILE)" ?
Thank you in advance
Dario

The magic comes from the strrchr function.

And, the ternary operator

dariomella:
#define FILENAME (strrchr(FILE, '\') ? strrchr(FILE, '\') + 1 : FILE)

If
(the address of the last backslash in the filename is not NULL)
?
use the address after the last backslash
: (else)
use the address of the start of the string

Thank you !

the last backslash

Doesn't sound very OS-independent!