found 'char *', expected 'const wchar_t *'.

Started by ml1969, March 22, 2009, 01:36:23 PM

Previous topic - Next topic

ml1969

Hello,

waht I want to do ist qiuet simple  ::)...

I want to read one thing from txt. file
it looks like
\windows\explorer.exe  or something like that....

I do this with:

.....
FILE *f;
char zeile[80];
......


and


if ( ( f = fopen("\\Storage Card\\test.txt", "r" ) ) == NULL)
     {
     fgets(zeile, 80, f);
     fclose(f);
     }


now I want to use createprocess in this way

CreateProcess(zeile, NULL,0,0,FALSE,0, 0, 0, NULL, NULL);

but I get the error found 'char *', expected 'const wchar_t *'.

Ok I understand, but how can I solve it?


Michael


frankie

Michael,
you're programming on wince as I understand, for wince everything is unicode. The base character for unicode is a two bytes unit defined as wchar. So simply:

.....
FILE *f;
wchar zeile[80];
......


and

if ( ( f = fopen(L"\\Storage Card\\test.txt", "r" ) ) == NULL)
     {
     fgets(zeile, 80, f);
     fclose(f);
     }


Where the 'L' before the filename tells the compiler to encode the filename itself as unicode widechar.
Before continuing I suggest that you read some tutorial for wince programming. You'll find information in the smarthphone section of this blog and googling around.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

ml1969

HI,

you are right, I will programm for an WinCe Device,
and all other things will work
createprocess, terminateprocess, registry-" editing" etc....

at least I want to create a file like a ini oder txt file, which include only one parameter (path to file & file)
I want to read this file (it works)
I want to start the executeable with the createprocess-command.


And looking for the solution for a few days (msdn, google, etc...

Michael