Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
smartphone "windows mobile 6.5" "native C++" MVS 2008
Posted by Libor in Other Languages
27-Aug-10 09:43 AM


Hello, I'm having problem with any read/write operation in an app I'm doing for my Samsung Omnia 8000 phone.
I'm using Microsoft Visual Studio 2008, -> project template "C++" ->Smartphones.
I'm using below code. It also does not work.:
C++
HANDLE hFile;
   DWORD wmWritten;
   char strData[] = "Test data written to explain the win32 file sample";
   hFile = CreateFile(_T("\\test.txt"),GENERIC_READ|GENERIC_WRITE,
    FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
   WriteFile(hFile,strData,(DWORD)(sizeof(strData)),&wmWritten,NULL);
   FlushFileBuffers(hFile);
   CloseHandle(hFile);
On PPC, it just pretends to work, ( wmWritten is set properly ). Nevertheless, the file is not writen to my phone, niether it is written to the shared folder in MVS 2008 PPC emulator.
The code
    FILE *fs = fopen("protocol.txt", "a");
      fprintf(fs, "end of execution\n");
      fclose(fs);

When a similar project for PC is created, it works well. The same apply for ReadFile(). Things like dialogs etc. work in a project for my PPC without any difficulties.
I must be missing something fundamental but I cann't find what it is.
Programming in CompactFramework environment seems to work fine, icl. I/O operation. But my old PDA does not have .net support...

Thanks for help. Libor
Posted
Updated 28-Aug-10 0:24am
v2
Comments
tatulda 31-Aug-10 7:50am    
It's solved. The problem was that "\Storage Card\" must be added to the filename. Note that this string does not change depending on MVS language configuration. I t depends probably on MVS PPC simulator implementation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900