Language :

Current Directory on Windows Mobile

So it seems there is no “Current Directory” on windows mobile. If you open a file like this : 

fopen(“MyFile.xml”, … )

it will look for it at the root of the pocket pc. While it can be sufficient for testing, you don’t want to mess up this directory with files related to your application.

What you can do, is retrieve the pathname of the module ( application ) that is currently running : 


WCHAR lPath[256];

GetModuleFileName(NULL, lPath, 255);

std::wstring lPathWStr(lPath);

lPathWStr = lPathWStr.substr(0, lPathWStr.find_last_of(‘\\’)).append(L”\\MyFile.xml”);


This way, you can navigate to the folder where your application is stored, and add your data files in there, where they belong.

Also something interesting, to move configuration, or additional data files to your Emulator, you can setup a shared folder. In  your emulator : File => Configure => General Tab

All files drag&dropped in this folder ( on your computer ) will appear in the “Storage Card” of your Emulator, and you can move them around with the file explorer.

Comments are closed.