Suppose source code file name is test.cpp
. When it is compiled, it produce test.exe
file. When I execute it, it should identify its file name that is test.exe
and print it.
I'm able to get list of all the files and directories present in the current directory using following code:
DIR * directory;
struct dirent * direct;
direct = readdir(directory);
But, how can I identify the associated file name, in this case which is "test.exe"
?