Extracts the file name part without the path from a string of full path file name.
string GetFileName( LPCSTR lpcszFullPathFileName, BOOL bRemoveExt = FALSE )
A string containing only the file name with extension or not depending on bRemoveExt.
EX1
// This is a self contained sample program for the function GetFileName, // To run the program, enter the following command in the Script window: // GetFileName_ex1 // When you run this program, the following meassages will be printed out: // GetFileName done (RemoveExt Flag:OFF(default)): "c:\c\test.dat" => "test.dat" // GetFileName done (RemoveExt Flag:ON): "c:\c\test.dat" => "test" // void GetFileName_ex1() { string strOnlyFileName; string strFullPathFileName = "c:\\c\\test.dat"; strOnlyFileName = GetFileName(strFullPathFileName); printf(" GetFileName done (RemoveExt Flag:OFF(default)): \"%s\" => \"%s\"\n", strFullPathFileName,strOnlyFileName); strOnlyFileName = GetFileName(strFullPathFileName,TRUE); printf(" GetFileName done (RemoveExt Flag:ON): \"%s\" => \"%s\"\n", strFullPathFileName,strOnlyFileName); }
origin.h