-
Win2k SetCurrentDir
SetCurrentDirectory(strCurrentDir);
Does not work in W2k.
I call this from OnFileOpen.. any way to overcome this problem
void MyApp::OnFileOpen(){ char szCurrentDir[MAX_PATH]; ::GetCurrentDirectory(MAX_PATH, szCurrentDir); // switch to the default folder// THis also does not work GetMainFrame()->SetDefaultExperimentFolder();// THis does not work ::SetCurrentDirectory(GetMainFrame()->GetDataDirectory()); CWinApp::OnFileOpen(); ::SetCurrentDirectory(szCurrentDir);}
-
Do this!!
Did you do this, otherwise try it!!
#include <direct.h>
int main()
{
int drive = 2; // Or whatever drive you want, this is C: for me
if (! _chdrive(drive))
{ cerr << "Unable to locate current drive" << endl; }
return 0;
}
this should work, and you current drive should be C:, within this function...
-
If you arent talking about programming in a console, then forget about the last post.
-
It should work ok.....
More likely you are passing an incorrect param to the function...
Put the params in a messagebox each time you call them to see if any stray " marks have entered there......also call GetLastError after each call to SetCurrentDirectory() to see what grumbles the system may have....