Click here to Skip to main content
15,914,225 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Noob question on structs, and their local variables Pin
Anthony Mushrow25-Nov-07 11:57
professionalAnthony Mushrow25-Nov-07 11:57 
GeneralRe: Noob question on structs, and their local variables Pin
Stephen Hewitt25-Nov-07 12:03
Stephen Hewitt25-Nov-07 12:03 
GeneralRe: Noob question on structs, and their local variables Pin
Priya_Sundar26-Nov-07 0:19
Priya_Sundar26-Nov-07 0:19 
QuestionClick and drag combobox Pin
Wxffles25-Nov-07 9:46
Wxffles25-Nov-07 9:46 
QuestionCString problem in visual C++ 2005 Pin
DSPCottage25-Nov-07 8:53
DSPCottage25-Nov-07 8:53 
QuestionRe: CString problem in visual C++ 2005 Pin
Mark Salsbery25-Nov-07 9:04
Mark Salsbery25-Nov-07 9:04 
AnswerRe: CString problem in visual C++ 2005 Pin
DSPCottage25-Nov-07 9:19
DSPCottage25-Nov-07 9:19 
GeneralRe: CString problem in visual C++ 2005 Pin
Mark Salsbery25-Nov-07 9:40
Mark Salsbery25-Nov-07 9:40 
You shouldn't need the cast.  CString has a cast operator that does this for you.

I'm still wondering what the actual compiler error is.

Gut Mikh Tappe wrote:
we can cast a CString variable to a char* by using (LPCTSTR)


That's not a valid cast.  LPCTSTR is a constant pointer to a TCHAR.
TCHAR can be a char or a wchar_t, depending on if _UNICODE is defined.

Without knowing the error message, I'm guessing your build settings are for unicode,
in which case you should either change the project settings to not use unicode, use the
correct CStringT type, or use _tfopen() instead of fopen().

Regardless, you should NOT need the cast.  Casts should be used only when absolutely necessary,
because they can hide errors, exactly as demonstrated here.


Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: CString problem in visual C++ 2005 Pin
Sarath C25-Nov-07 15:18
Sarath C25-Nov-07 15:18 
GeneralRe: CString problem in visual C++ 2005 Pin
lostangels27-Nov-07 5:16
lostangels27-Nov-07 5:16 
GeneralRe: CString problem in visual C++ 2005 Pin
Richard Andrew x6425-Nov-07 10:05
professionalRichard Andrew x6425-Nov-07 10:05 
AnswerRe: CString problem in visual C++ 2005 Pin
Stephen Hewitt25-Nov-07 17:34
Stephen Hewitt25-Nov-07 17:34 
QuestionHow to use FindFirstFile and FindNextFile Pin
mrby12325-Nov-07 8:44
mrby12325-Nov-07 8:44 
AnswerRe: How to use FindFirstFile and FindNextFile Pin
Mark Salsbery25-Nov-07 8:56
Mark Salsbery25-Nov-07 8:56 
GeneralRe: How to use FindFirstFile and FindNextFile Pin
mrby12325-Nov-07 10:50
mrby12325-Nov-07 10:50 
AnswerRe: How to use FindFirstFile and FindNextFile Pin
Luc Pattyn25-Nov-07 9:17
sitebuilderLuc Pattyn25-Nov-07 9:17 
GeneralRe: How to use FindFirstFile and FindNextFile Pin
Mark Salsbery25-Nov-07 9:42
Mark Salsbery25-Nov-07 9:42 
AnswerRe: How to use FindFirstFile and FindNextFile Pin
Hamid_RT25-Nov-07 18:16
Hamid_RT25-Nov-07 18:16 
Questionlinker error - please help Pin
gizmokaka25-Nov-07 8:11
gizmokaka25-Nov-07 8:11 
AnswerRe: linker error - please help Pin
Mark Salsbery25-Nov-07 8:35
Mark Salsbery25-Nov-07 8:35 
GeneralRe: linker error - please help Pin
gizmokaka25-Nov-07 8:39
gizmokaka25-Nov-07 8:39 
GeneralRe: linker error - please help Pin
Mark Salsbery25-Nov-07 8:46
Mark Salsbery25-Nov-07 8:46 
GeneralRe: linker error - please help Pin
gizmokaka25-Nov-07 8:46
gizmokaka25-Nov-07 8:46 
GeneralRe: linker error - please help Pin
Mark Salsbery25-Nov-07 8:49
Mark Salsbery25-Nov-07 8:49 
GeneralRe: linker error - please help Pin
gizmokaka25-Nov-07 8:55
gizmokaka25-Nov-07 8:55 

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.