__FILE__ macro shows full path

Try

#include <string.h>

#define __FILENAME__ (strrchr(__FILE__, "https://stackoverflow.com/") ? strrchr(__FILE__, "https://stackoverflow.com/") + 1 : __FILE__)

For Windows use ‘\\’ instead of “https://stackoverflow.com/”.

Leave a Comment