I have some basic questions:
1) If my code is running on an OMAP-L138 LogicPD Zoom EVM, and wants to generate data files, I'm in a WinCE environment. I think it makes sense then, that any data files generated would be unicode unless I use widetomultibyte(). Correct?
2) If I transferred those files to say, a Win7 PC for analysis, the same data files would have to be ASCII. Correct?
3) I'm trying to take a couple of static data values in my code, and write them to a file while in the WinCE environment. From 2), it seems I should generate ASCII files.
Below is my code for 3), but it doesn't seem to work for ASCII. Please explain how to fix to generate an ASCII file. Having difficult time with all these conversions.
4) How would the below change if the smart device is reading files already on (or generated from) the smart device?
HANDLE outfileHnd;
DWORD dwBytesRead, dwButesWritten;
TCHAR *bufOUT;
bufOUT = _T("\\SDCard\\fileOUT.txt");
int data1 = 2;
int data2 = 3;
outfileHnd = CreateFileW(bufOUT, GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
WHAR uout[20];
LPSTR aout;
LPCTSTR format = (L"%d %d\n");
StringCchPrintfW(uout,wcslen(uout),format,data1,data2);
WideCharToMultiByte (CP_ACP,0,uout,-1,aout,strlen(aout),NULL,NULL);
WriteFile(outfileHnd, aout,strlen(aout),&dwBytesWritten,NULL);
Note: a) When I eliminate the widetomulti line, and do a writefile using uout and (wcslen(uout)+1), I get "20 03" in the generated file on the SD card, but that's unicode and has extra "0"s that shouldn't be there. If I didn't do the "+1", I'd get only the "20".
b) If I then take the card, and open the file on a Win7 PC, I see "2 3", just like it should be. There are 3 spaces between the numbers. What's happeing with these characters? Looks strange on the device, but not on the PC using NotePad. NotePad reading unicode?
c) If I change the data2 to 12.34, on the device I see: 20 01020, and that's it. On the PC I see: 2 1 2 ., with one space between the numbers in the float. (Never see the "34".) In fact, on close inspection, each "0" in the file = 1 space when viewed on the PC.
Thanks much for your help.
DM
********************** WCSTOMBS() SEEMS TO WORK BETTER/EASIER THAN WIDECHARTOMULTBYTE() FOR WINCE 6.0. ******************
DM