cophi
asked on
CString for ifstream
I have a cstring which contains the path to the file I want to use.
So fill in the blank what I should put here.
ifstream in(BLANK);
I've tried GetBuffer and it complained. I tried casting to LPCTSTR and it complained.
So fill in the blank what I should put here.
ifstream in(BLANK);
I've tried GetBuffer and it complained. I tried casting to LPCTSTR and it complained.
How exactly does it complain?
ASKER
error C2440: 'initializing' : cannot convert from 'ATL::CSimpleStringT<BaseT ype,t_bMFC DLL>::PCXS TR' to 'const char *'
with
[
BaseType=wchar_t,
t_bMFCDLL=true
]
with
[
BaseType=wchar_t,
t_bMFCDLL=true
]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CString s;
ifstream in(s);
CString s;
wifstream in(s);
Both versions are compiled in my VC++ 8.0.
ifstream in(s);
CString s;
wifstream in(s);
Both versions are compiled in my VC++ 8.0.