To get filename from filepath..?
-
How to get file name from a given filepath without using winAPI for both windows and mac env?
-
How to get file name from a given filepath without using winAPI for both windows and mac env?
-
How to get file name from a given filepath without using winAPI for both windows and mac env?
#include std::string strPath = "c:\\blah\\blahblah\\file.txt"; int pos = strPath.find_last_of("\\"); std::string strFile = strPath.substr(pos + 1); That should do it. -- Rocky Dean Pulley
-
#include std::string strPath = "c:\\blah\\blahblah\\file.txt"; int pos = strPath.find_last_of("\\"); std::string strFile = strPath.substr(pos + 1); That should do it. -- Rocky Dean Pulley
sorry, that first line is supposed to be: #include I forgot to remove the <'s as HTML tags. -- Rocky Dean Pulley