This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Bunch of errors


Bunch of errors

Postby Datalore » Aug 1, 2003 @ 10:41pm

User avatar
Datalore
pm Member
 
Posts: 158
Joined: May 11, 2003 @ 1:58am


Postby simonjacobs » Aug 1, 2003 @ 10:51pm

I think your function calls are expecting strings in multi byte format on the ppc instead of single byte on the desktop. Either try:

L"text" instead of "text" or convert them. There is a function to convert which I dont remember off hand, search for string conversion in the docs.

WideCharToMultiByte or something.
User avatar
simonjacobs
pm Insider
 
Posts: 311
Joined: Nov 27, 2001 @ 4:51pm
Location: London, UK


Postby Kzinti » Aug 1, 2003 @ 11:26pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby fzammetti » Aug 2, 2003 @ 1:28am

I used to have a problem with this, until I learned the "pattern"... Always use the TEXT() macro, and then only use functions defined in TCHAR.h, as Thierry said (hint: when in VC++ or I think eVC++ as well, look up the function you want in the docs, say swprintf or printf, and scroll down, there is usually a section labeled Generic Text String Mappings, and it shows the TCHAR.h function name there... just use that!). Do these things and you should be able to compile for the desktop and PPC's without any problems.
...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby Datalore » Aug 2, 2003 @ 3:51am

User avatar
Datalore
pm Member
 
Posts: 158
Joined: May 11, 2003 @ 1:58am


Postby fzammetti » Aug 2, 2003 @ 3:57am

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby Datalore » Aug 2, 2003 @ 4:42am

Ah, your suggestion worked. 1 error down, the rest to go. Unfortunately, your suggestion only helped that one example. I'm mainly getting crap like "cannot convert from char[19] to unsigned short". Thanks so much for helping with this.
User avatar
Datalore
pm Member
 
Posts: 158
Joined: May 11, 2003 @ 1:58am


Postby fzammetti » Aug 2, 2003 @ 4:54am

That error generally points to the same kind of problem... Your passing in an array of char's, but it's looking for a pointer (I believe an LPCSTR is the same thing as an unsigned short in this case).
...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby simonjacobs » Aug 2, 2003 @ 11:36am

User avatar
simonjacobs
pm Insider
 
Posts: 311
Joined: Nov 27, 2001 @ 4:51pm
Location: London, UK


Postby fzammetti » Aug 2, 2003 @ 2:22pm

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby simonjacobs » Aug 2, 2003 @ 2:51pm

User avatar
simonjacobs
pm Insider
 
Posts: 311
Joined: Nov 27, 2001 @ 4:51pm
Location: London, UK


Postby fzammetti » Aug 2, 2003 @ 3:07pm

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby ChezDoodles » Aug 2, 2003 @ 8:51pm

To convert from char[] to wchar[], use MultiByteToWideChar, and to go from wchar[] to char[] use WideCharToMultiByte.

Don't worry that the funtion is called "MultiByte" - it refers to MBCS (MultiByteCharacterString) which is also a char[] deep down. MBCS is normally one 1 byte chars - but some characters inbetween can be 2 byte to support special characters sets. MBCS was a step along the way from ANSI to UNICODE on the Win9x platform back in the '90s.
User avatar
ChezDoodles
pm Insider
 
Posts: 73
Joined: Jan 24, 2002 @ 11:00pm


MBCS

Postby mlepage » Aug 3, 2003 @ 4:26am

I believe MBCS is variable-byte-length characters. That is, physically, the string is single byte characters, but logically, a character can be 2 (or more?) bytes. It makes algorithms (e.g. go forward 4 characters) hell. Stick with single-byte characters or UNICODE (wide characters).
mlepage
 


Postby ChezDoodles » Aug 3, 2003 @ 8:18am

Check the documentation to the two functions - you can specify ANSI codepages - meaning there is no risk ending up with characters that actually takes up more space than one byte if you don't want to.
User avatar
ChezDoodles
pm Insider
 
Posts: 73
Joined: Jan 24, 2002 @ 11:00pm


Next

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron