I'm trying to use file I/O functions to log debugging statements that I can view on the handheld. The code I got from msdn seems to do the trick except when I open the file on the handheld, PocketWord only displays the first character I write to the file. If I copy the file to the desktop, everything I wrote to the file appears as it should. My code for all of my file I/O is as follows:
BOOL LogStartup (void)
{
HANDLE file;
TCHAR szFileName [MAX_PATH];
memset (szFileName, 0, MAX_PATH * 2);
wcscpy (szFileName, TEXT (
"\\folder\\logfile.txt"));file = CreateFile (szFileName, GENERIC_WRITE,
FILE_SHARE_WRITE,NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
LogFileHandle = file;
return TRUE;}
BOOL LogClose (
void){
CloseHandle (LogFileHandle);
return TRUE;}
int
LogWrite (TCHAR *szError){
DWORD BytesWritten = 0;
int
len = wcslen (szError); if (!WriteFile (LogFileHandle, szError, len * 2, &BytesWritten, NULL))ErrorExit (hWnd, TEXT (
"WriteFile"));return BytesWritten;
}
Where ErrorExit is a function with GetLastError and MessageBox(), and LogFileHandle is a global.

File I/O
Bhushan Akole
Hi Mish,
I am facing the same problem which u had faced earlier while using Writefile() to write data in a .txt file of PDA.
I am trying to save the data(read tags) which is in the form of string in a file. I can save the data in the file but cant see all the charachters except 1st, when the file is opened in Pocketword on PDA . I downloaded the file on PC and can open read the data in wordpad/notepad/excel.
I read your opinion that char * works as Pocketword doesnt support w_char and added this new code but still no difference. Please rectify my code below.
static unsigned short Buffer[1000] = {0}; // unicode buffer
unsigned short *pwc = &Buffer[1000];
Charles W
robincurry
Hope this helps.
TheMilkMan
Mr Big