Because in Windows, with Visual Studio, the __FILE__
macro can give lower-case strings, and because I need to know the correctly-cased filename (as perceived by users), I am trying to work out how to convert an all lower-case path on windows to the correctly cased one.
It looks like using stat to get info about the file may be a good starting point.
But how, given a stat object, can I get the filename?
#include <sys/stat.h>
#include <string>
void test()
{
std::string file_name = "C:\\WiNdoWs";
struct stat statbuf;
int stat_ok = stat(file_name.c_str(), &statbuf);
auto file_serial_number = statbuf.st_ino;
std::string full_file_name = ???;
}
We would like to do this without adding a dependency on either boost filesystem or Qt, or moving to C++17.
Aucun commentaire:
Enregistrer un commentaire