NO

Author Topic: found 'char *', expected 'const wchar_t *'.  (Read 2890 times)

ml1969

  • Guest
found 'char *', expected 'const wchar_t *'.
« on: March 22, 2009, 01:36:23 pm »
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:

Code: [Select]
.....
FILE *f;
char zeile[80];
......

and

Code: [Select]
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


Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1766
Re: found 'char *', expected 'const wchar_t *'.
« Reply #1 on: March 22, 2009, 01:50:33 pm »
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:
Code: [Select]
.....
FILE *f;
wchar zeile[80];
......

and

Code: [Select]
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.

ml1969

  • Guest
Re: found 'char *', expected 'const wchar_t *'.
« Reply #2 on: March 22, 2009, 02:02:25 pm »
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