type conversion

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2007
Posts: 37
Reputation: Tales is an unknown quantity at this point 
Solved Threads: 1
Tales Tales is offline Offline
Light Poster

type conversion

 
0
  #1
Apr 6th, 2007
I need to find a way to convert char[] to TCHAR[]

I did my best to find it, but all I could find was char[] to wchar_t[]

using...

int swprintf( wchar_t *buffer, const wchar_t *format [, argument] ... );

Help please!
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: type conversion

 
0
  #2
Apr 6th, 2007
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 37
Reputation: Tales is an unknown quantity at this point 
Solved Threads: 1
Tales Tales is offline Offline
Light Poster

Re: type conversion

 
0
  #3
Apr 6th, 2007
Well, I did this:

char myCharVar[MAX_CHAR];
(TCHAR)myCharVar

I know this is not a very good practice, but I couldn't find a better wayand I am in a hurry with this program...
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,440
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1473
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: type conversion

 
0
  #4
Apr 6th, 2007
TCHAR is a macro that is defined to be char* if UNICODE is not defined, or wchar_t if UNICODE is defined. If you want to convert from char* to wchar_t* regardless of UNICODE definition then you can not use the TCHAR macro. one data type can not be converted to the other by simply typcasting -- you must use one of the convertion functions, such as this one.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC