Hi,
I am trying to port my program TunePal:
http://www.bryanduggan.com/TunePal.html
To Windows Mobile Pocket PC to run on my Palm Treo 500v smartphone. I
cant get this simple file writing code to work:
void testFile()
{
FILE * fp = NULL;
fp = fopen("\\temp\\test.txt", "w");
int r = fprintf(fp, "Hello world!!\n");
fclose(fp);
HANDLE file;
char * msg = "Hello world!";
CreateFile(L"\\temp\\test1.txt", GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, file);
WriteFile(file, msg, strlen(msg), 0, 0);
CloseHandle(file);
exit(0);
}
In both cases, the files are created correctly, but there is nothing
in the contents (the length of the files is 0 bytes. Also the value of
r is 0 after the call to fprintf. I have tried adding fflush before
closing the files and writing files to various locations (internal
memory and an SD card inserted in the device) In all cases, the files
are created, but there is no contents. Ive also had problems with this
program:
http://classic.pocketgear.com/software_detail.asp?id=26010&associateid=9
I dont know if its related, but it wont write a file copy of my sim
card.
Is there some strange problem writing files on this device or am I
going mad!
Thanks,
Bryan