Click here to Skip to main content
15,913,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can i remove spaces in my database ? Pin
_AnsHUMAN_ 25-Sep-06 23:30
_AnsHUMAN_ 25-Sep-06 23:30 
GeneralRe: How can i remove spaces in my database ? Pin
Hamid_RT25-Sep-06 23:40
Hamid_RT25-Sep-06 23:40 
GeneralRe: How can i remove spaces in my database ? Pin
_AnsHUMAN_ 25-Sep-06 23:49
_AnsHUMAN_ 25-Sep-06 23:49 
AnswerRe: How can i remove spaces in my database ? Pin
Waldermort26-Sep-06 0:11
Waldermort26-Sep-06 0:11 
AnswerRe: How can i remove spaces in my database ? Pin
David Crow26-Sep-06 3:06
David Crow26-Sep-06 3:06 
QuestionAbout printer queue Pin
hsdok25-Sep-06 22:56
hsdok25-Sep-06 22:56 
QuestionRe: About printer queue Pin
David Crow26-Sep-06 3:08
David Crow26-Sep-06 3:08 
QuestionHow to correctly create a UNICODE tstring from a char[]? Pin
BarryOg25-Sep-06 22:56
BarryOg25-Sep-06 22:56 
Hello Everyone, I am here again with a UNICODE Question. I hope this is the last one Smile | :) . I am trying to create a tstring from a char[]. From the debugger the contents of the string looks correct but when I try to use it in an DirectX api call it compiles and runs but does not function correctly. I have seen this error before and it was down to using ASCII instead of UNICODE and I solved it by defining UNICODE and using _T() either when creating a string or harding coding a api call param. But this does not work with a char[]. Here is my code:

#ifdef UNICODE<br />
typedef wstring tstring;<br />
#else<br />
typedef string tstring;<br />
#endif<br />
<br />
char szFile[350];<br />
//create a file dialog info struct and fill it up as required than point it too our char buffer<br />
ofn.lpstrFile = (LPWSTR)szFile;<br />
//once the dialog has run the lpstrFile will contain the path and filename<br />
tstring fileName (ofn.lpstrFile);<br />
//attempt to get file details using DirectX function<br />
D3DXGetImageInfoFromFile(fileName.c_str(), &Info);<br />
<br />


I have only put in the code that directly relates to what I think is the problem for clarity sake. The code works if I replace fileName.c_str() with _T("actual file path") which is why I think the problem is with how I have encoding the string. Is the problem with (LPWSTR)? I did not think so as I was only getting it to point to the array. Any help is really appreciated.
AnswerRe: How to correctly create a UNICODE tstring from a char[]? Pin
Nibu babu thomas25-Sep-06 23:05
Nibu babu thomas25-Sep-06 23:05 
AnswerRe: How to correctly create a UNICODE tstring from a char[]? Pin
Steve S26-Sep-06 0:08
Steve S26-Sep-06 0:08 
GeneralRe: How to correctly create a UNICODE tstring from a char[]? Pin
BarryOg26-Sep-06 4:01
BarryOg26-Sep-06 4:01 
GeneralRe: How to correctly create a UNICODE tstring from a char[]? Pin
Steve S27-Sep-06 1:34
Steve S27-Sep-06 1:34 
GeneralRe: How to correctly create a UNICODE tstring from a char[]? Pin
BarryOg29-Sep-06 3:37
BarryOg29-Sep-06 3:37 
QuestionThread + Serial communication? Pin
Sunshine Always25-Sep-06 22:50
Sunshine Always25-Sep-06 22:50 
AnswerRe: Thread + Serial communication? Pin
Roger Stoltz25-Sep-06 23:25
Roger Stoltz25-Sep-06 23:25 
QuestionFont problem Pin
mikobi25-Sep-06 22:36
mikobi25-Sep-06 22:36 
AnswerRe: Font problem Pin
Hamid_RT25-Sep-06 23:24
Hamid_RT25-Sep-06 23:24 
AnswerRe: Font problem Pin
Steve S26-Sep-06 0:01
Steve S26-Sep-06 0:01 
AnswerRe: Font problem Pin
mikobi26-Sep-06 20:40
mikobi26-Sep-06 20:40 
GeneralRe: Font problem Pin
Steve S27-Sep-06 1:40
Steve S27-Sep-06 1:40 
GeneralRe: Font problem Pin
mikobi28-Sep-06 0:30
mikobi28-Sep-06 0:30 
AnswerFont problem Pin
mikobi26-Sep-06 20:57
mikobi26-Sep-06 20:57 
QuestionProcess dependencies Pin
nmx_de25-Sep-06 21:46
nmx_de25-Sep-06 21:46 
AnswerRe: Process dependencies Pin
nutkase25-Sep-06 23:31
nutkase25-Sep-06 23:31 
GeneralRe: Process dependencies Pin
nmx_de25-Sep-06 23:47
nmx_de25-Sep-06 23:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.