How to get current directory path in mfc??
-
Parse it from using
GetModuleFileName()
My articles www.stillwaterexpress.com BlackDice -
The CWD is obtained with
GetCurrentDirectory()
.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
Try with this code:
CFile file; if(file.Open(".",CFile::modeRead)) { MessageBox(file.GetFilePath()); }
Ivan Cachicatari Blog[^] www.latindevelopers.com
-
c+- wrote: How to get current directory path in mfc?? This Code Will help
//=========================
// Get Current Path
//=========================
CString szCurrentDirectory;
{
CString csPath;//====================
// Get File Path
//====================::GetModuleFileName(NULL,csPath.GetBuffer(MAX_PATH),MAX_PATH);
csPath.ReleaseBuffer();
//====================
//Get current Directory
//====================
szCurrentDirectory=csPath.Left(csPath.ReverseFind('\\'));}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV