Hi everybody,
while I am using file.WriteString(); with CStdioFile there is an error nobody can explain in other forums and discussion boards:
error C2039: 'WriteString' : is not a member of 'CStdioFile'
c:\...\mfc\include\afx.h(1487) : see declaration of 'CStdioFile'
I don't understand because every other things works well with CStdioFile (for example Open or CFile::modeWrite etc.). I want to write in a .txt-file and don't like things like the little squares (for \n) in the text files. Now I use file.Write(); but here I have these little squares I don't want.
The program I use is: embedded Visual C++ 4 SP4 for pocket pc and mobile windows 2003.

problems with WriteString and CStdioFile
YohanAudoux
CStdioFile file;
// etc.
if (file.Open(dateiname, CFile::modeWrite | CFile::modeCreate | CFile::modeNoTruncate, &e )) {
if (file.GetLength() == 0) {
text.Format(_T("Log file Bsp1 %s %s\n"), geraet, typ);
}
else {
text.Format(_T("Bsp2 %s %s\n"), geraet, typ);
}
file.SeekToEnd();
file.WriteString(text);
file.Close();
} // end if
else {
MessageBox(L"Fehler beim Dateioffnen",L"Error");
}
Super login chat
this is the part from afx.h, it looks ok:
class CStdioFile : public CFile
{
DECLARE_DYNAMIC(CStdioFile)
public:
// Constructors
CStdioFile();
WCE_DEL CStdioFile(FILE* pOpenStream);
CStdioFile(LPCTSTR lpszFileName, UINT nOpenFlags);
// Attributes
WCE_DEL FILE* m_pStream; // stdio FILE
// m_hFile from base class is _fileno(m_pStream)
// Operations
// reading and writing strings
WCE_DEL virtual void WriteString(LPCTSTR lpsz);
WCE_DEL virtual LPTSTR ReadString(LPTSTR lpsz, UINT nMax);
WCE_DEL virtual BOOL ReadString(CString& rString);
Luckyboy
jamhow
Additionally I have to say that I am using these libraries:
#include <afx.h>
#include <time.h>
#include <string.h>
and others, too.
the_lmich
Please find it here , It explains that write string is not supported
--Srikanth (MSFT)
Microsoft Foundation Class Library for Windows CE
CStdioFile
This class is derived from CFile. Because CStdioFile does not support any methods or data members that are not supported by CFile, use the CFile reference documentation for method specifics.
Use CStdioFile, instead of CFile, when you want to work with Internet classes.
A CStdioFile object represents a C run-time stream file as opened by the run-time function fopen. Stream files are buffered and can be opened in either text mode, the default, or binary mode.
Text mode provides special processing for carriage return–linefeed pairs. When you write a newline character (0x0A) to a text-mode CStdioFile object, the byte pair (0x0A, 0x0D) is sent to the file. When you read, the byte pair (0x0A, 0x0D) is translated to a single 0x0A byte.
The CFile methods Duplicate, LockRange, and UnlockRange are not supported for CStdioFile.
If you call these functions on a CStdioFile, you will get a CNotSupportedException .
Remarks
MFC for Windows CE does not support the following methods of the standard MFC CStdioFile class:
* CStdioFile::ReadString
* CStdioFile::WriteString
* CStdioFile::CFile
* CStdioFile::Abort
* CStdioFile::Flush
* CStdioFile::Close
* CStdioFile::Read
* CStdioFile::Write
* CStdioFile::LockRange
* CStdioFile::UnlockRange
* CStdioFile::GetPosition
* CStdioFile::Open
* CStdioFile::Duplicate
In addition, MFC for Windows CE does not support the CStdioFile::m_pStream data member.
Requirements
Windows CE versions: 2.10 and later
Header file: Declared in Afx.h
See Also
File Service Classes
________________________________
Send feedback to Microsoft
© 2001 Microsoft Corporation. All rights reserved.
Topic Version 7.0.9429.1425
jporto
Do you have a small program to repro this
mjf_29
flyonthewall
Maybe you accidental change the afx.h!
BruceJohnson
For all others: No, I do not looked into it and I do not changed it.