I need to do file operations in WinCE in a Windows mobile 6 project in visual studio 2008.
For opening a file i did like below.
HANDLE hFile = CreateFile(__TEXT("\\1.txt"), GENERIC_READ ,
FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
But hFile is coming as 0xffffffff. File open failed.
File exists in d:\
I tried paths like d:\\1.txt , 1.txt
But none of them are working.
Filename path should be relative to which directory ?
Kindly help me.
EDIT: The problem is it is trying to search the path in WinCE emulator.
But my file is present in System harddisk d:\
So i am unable to access files present in my computer when using WinCE.
Now the question changes to, How to copy files in Computer to Emulator ?
My guess is that your file is not there.
In order to share a folder from your harddisk with the emulator, go to your emulator menu:
“File -> Configure … -> General -> Shared folder:”. This folder will be seen as “Storage Card”.
Lets say you map d:\wm, then you put 1.txt in d:\wm, afterwards the file path for ::CreateFile becomes: L”\\storage card\\1.txt”.