Re: wofstream question again
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
- From: "Jack" <jl@xxxxxxxxxx>
- Date: Tue, 4 Aug 2009 15:03:31 +0800
Hi,
I made a mistake by using ofstream instead of ifstream.
But now I've got a new question, is that how do you
convert between CString and std::wstring?
[code]
DDX_Text(pDX, IDC_RECEIVE, a);
DDX_Text(pDX, IDC_RSVRNAME, b);
DDX_Text(pDX, IDC_SEND2, c);
wsprintf (pDoc->m_strRecv, _T("%s"), a);
wsprintf (pDoc->m_strServer, _T("%s"), b);
wsprintf (pDoc->m_strSend, _T("%s"), c);
[/code]
The data exchange parts were okay.
But I couldn't get wsprintf (...) to compile
since that did not allow conversion between LPWSTR and std::wstring
Thanks in adv.
Jack
.
Relevant Pages
- Re: Outputting a CString to File Problem
... not the text in the CString I intended. ... CString sPathToSettings = GetWorkingDirectory; ... ofstream OutFile; ... CString has LPCTSTR cast operator so you should not need this explicit ... (microsoft.public.vc.mfc) - Re: C++ Programming: using File
... TheOne wrote: ... > ifstream and ofstream, how can a record in a certain file be deleted ... from, what kind of constraints you have applied to the problem, if sure ... (comp.programming) - Re: operator[]
... There is a reason the cstring value cannot be used on the left side of an assignment, ... Furthermore, your code below violates the semantics of CString, because after the ... Writing exit() in a Windows program is always a mistake. ... (microsoft.public.vc.mfc) - Re: Outputting a CString to File Problem
... when I attempt to output a CString to a file via ofstream, the resulting output is a hex value, not the text in the CString I intended. ... The sPathToSettings string points to a valid path, as it does create a file successfully. ... CString has LPCTSTR cast operator so you should not need this explicit cast. ... (microsoft.public.vc.mfc) - Re: Outputting a CString to File Problem
... when I attempt to output a CString to a file via ofstream, the resulting output is a hex value, not the text in the CString I intended. ... The sPathToSettings string points to a valid path, as it does create a file successfully. ... CString has LPCTSTR cast operator so you should not need this explicit cast. ... (microsoft.public.vc.mfc) |
|