In my class I have FILE* ascii_file; data member, which always is initialized via class constructor. How can I get full path of the asci_file? I don’t want to store more information about the file expect ascii_file, and want it to work on windows, linux and solaris.
In my class I have FILE* ascii_file; data member, which always is initialized via
Share
This task is going to require non-portable code.
On Windows you can convert
FILE*to CRT file descriptor using _fileno, and then convert to an OS handle using _get_osfhandle.Then you can get the filename as shown here (using file mapping).