Click here to Skip to main content
16,007,443 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Converting CString to char* Pin
zafersavas10-Oct-08 8:27
zafersavas10-Oct-08 8:27 
GeneralRe: Converting CString to char* Pin
Mark Salsbery10-Oct-08 9:06
Mark Salsbery10-Oct-08 9:06 
GeneralRe: Converting CString to char* Pin
led mike10-Oct-08 9:09
led mike10-Oct-08 9:09 
GeneralRe: Converting CString to char* Pin
Mark Salsbery10-Oct-08 9:16
Mark Salsbery10-Oct-08 9:16 
GeneralRe: Converting CString to char* Pin
DSPCottage10-Oct-08 9:21
DSPCottage10-Oct-08 9:21 
GeneralRe: Converting CString to char* Pin
DSPCottage10-Oct-08 9:39
DSPCottage10-Oct-08 9:39 
GeneralRe: Converting CString to char* Pin
Cedric Moonen10-Oct-08 9:44
Cedric Moonen10-Oct-08 9:44 
GeneralRe: Converting CString to char* Pin
Mark Salsbery10-Oct-08 9:49
Mark Salsbery10-Oct-08 9:49 
The operator is a member of the CSimpleStringT class, which is the base
class of CStringT.

The actual operator is PCXSTR (the ATL type), which is the equivalent of LPCTSTR
(a Win32 type).

Here's your code using generic text types:
TCHAR buffer[MAX_PATH];
GetModuleFileName(NULL,buffer,MAX_PATH);
CString path = buffer;
path = path.Left(path.ReverseFind(_T('\\'))+1);
path += _T("result.mp3");
f = _tfopen( path , _T("wb"));  <code>// <-- implicitly uses CString's PCXSTR operator!</code>

See Generic-Text Mappings in Tchar.h[^]
and for Unicode info: International Programming[^]

Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

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 
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 

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.