Link to home
Start Free TrialLog in
Avatar of cophi
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.
Avatar of AlexFM
AlexFM

How exactly does it complain?
Avatar of cophi

ASKER

error C2440: 'initializing' : cannot convert from 'ATL::CSimpleStringT<BaseType,t_bMFCDLL>::PCXSTR' to 'const char *'
        with
        [
            BaseType=wchar_t,
            t_bMFCDLL=true
        ]
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
   CString s;
    ifstream in(s);

    CString s;
    wifstream in(s);

Both versions are compiled in my VC++ 8.0.