Click here to Skip to main content
15,902,276 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Converting CString to char* Pin
Cedric Moonen10-Oct-08 9:34
Cedric Moonen10-Oct-08 9:34 
GeneralRe: Converting CString to char* Pin
DSPCottage10-Oct-08 9:37
DSPCottage10-Oct-08 9:37 
AnswerRe: Converting CString to char* Pin
zafersavas10-Oct-08 8:25
zafersavas10-Oct-08 8:25 
GeneralRe: Converting CString to char* Pin
super_ttd11-Oct-08 4:28
super_ttd11-Oct-08 4:28 
AnswerRe: Converting CString to char* Pin
led mike10-Oct-08 8:52
led mike10-Oct-08 8:52 
GeneralRe: Converting CString to char* Pin
Cedric Moonen10-Oct-08 9:42
Cedric Moonen10-Oct-08 9:42 
GeneralRe: Converting CString to char* Pin
Mark Salsbery10-Oct-08 9:53
Mark Salsbery10-Oct-08 9:53 
AnswerRe: Converting CString to char* Pin
Mark Salsbery10-Oct-08 9:12
Mark Salsbery10-Oct-08 9:12 
In addition to super_ttd's reply...

If you must use fopen(), then you should probably use a CStringA.

CString has a generic internal character type, depending on whether
UNICODE or _UNICODE is defined.

If you want to use the generic text CString, then it will pair nicely
with the generic text version of fopen(), which is _tfopen().


Gut Mikh Tappe wrote:
char buffer[MAX_PATH];
GetModuleFileName(NULL,(LPWCH)buffer,MAX_PATH);


Bad cast!! GetModuleFileName takes a LPTSTR as its second parameter.
Your buffer, therefore, should be a TCHAR type, not char.

Mind your types.....if you need a cast to get something to compile, look at WHY.

Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Converting CString to char* Pin
DSPCottage10-Oct-08 9:40
DSPCottage10-Oct-08 9:40 
GeneralRe: Converting CString to char* Pin
Rick York10-Oct-08 12:30
mveRick York10-Oct-08 12:30 
QuestionCStatic with a scrollbar Pin
MrNyquist10-Oct-08 7:33
MrNyquist10-Oct-08 7:33 
AnswerRe: CStatic with a scrollbar Pin
led mike10-Oct-08 8:57
led mike10-Oct-08 8:57 
GeneralRe: CStatic with a scrollbar Pin
MrNyquist10-Oct-08 22:12
MrNyquist10-Oct-08 22:12 
AnswerRe: CStatic with a scrollbar Pin
Hamid_RT11-Oct-08 19:13
Hamid_RT11-Oct-08 19:13 
QuestionProblem with custom controls in dialog bar Pin
ilgale10-Oct-08 6:11
ilgale10-Oct-08 6:11 
AnswerRe: Problem with custom controls in dialog bar Pin
Ștefan-Mihai MOGA10-Oct-08 21:21
professionalȘtefan-Mihai MOGA10-Oct-08 21:21 
QuestionSet BAckground Picture Pin
Davitor10-Oct-08 2:52
Davitor10-Oct-08 2:52 
AnswerRe: Set BAckground Picture Pin
_AnsHUMAN_ 10-Oct-08 3:01
_AnsHUMAN_ 10-Oct-08 3:01 
AnswerRe: Set BAckground Picture Pin
Roger Stoltz10-Oct-08 3:04
Roger Stoltz10-Oct-08 3:04 
AnswerRe: Set BAckground Picture Pin
Hamid_RT11-Oct-08 19:13
Hamid_RT11-Oct-08 19:13 
Questionexcel API Pin
trioum10-Oct-08 1:02
trioum10-Oct-08 1:02 
AnswerRe: excel API Pin
Roger Stoltz10-Oct-08 1:50
Roger Stoltz10-Oct-08 1:50 
AnswerRe: excel API Pin
David Crow10-Oct-08 3:29
David Crow10-Oct-08 3:29 
QuestionEnumDisplayMonitors Pin
daavena10-Oct-08 0:39
daavena10-Oct-08 0:39 
QuestionRe: EnumDisplayMonitors Pin
Roger Stoltz10-Oct-08 1:36
Roger Stoltz10-Oct-08 1:36 

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.