error C2664: '_wfopen' : cannot convert parameter 1 from 'class CString' to 'const unsigned short *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
if i use fstPayroll = fopen(m_filename + L".txt","w+"); insted of _wfopen..it just takes the decimals values and not strings..such as CString
If I fix the last param (add a L to "w+") you code compiles ok for me.
I do notice the warning about 'unsigned short' rather than wchar_t, which make me wonder about the age of your compiler?
But as mordoran suggests, you should use the tchar.h macros, etc. Consistently!
Andy
PS Out of interest, where are you calling this fstream-based code from? MFC provides CStdioFile and CArchive which offer a more "MFC idomatic" way of writing and readin date. This hold especially if this code is in class derived from CDocument.
You insists on using _wfopen ... Then convert from ansi to unicode first ...
1 2 3 4
#include <atlbase.h>
USES_CONVERSION; // only needed for ATL < 7, as it seems the case here
CString path = m_filename + _T(".txt");
fstPayroll = _wfopen(CT2W(path) , L"w+");