char *pFileName="test.txt";
CStdioFile sf;
if(!sf.Open(pFileName,CFile::modeCreate|CFile::modeReadWrite|CFile::typeText))
{
#ifdef _DEBUG
afxDump<<"Unable to open file"<<"\n";
#endif
exit(1);
}
char aaa[]="aaa\n";// '\n' :0x0A
char *bbb="bbb\12";// '\12':0x0A
CString ccc("ccc\15");// '\15':0x0D
sf.WriteString(aaa);
sf.WriteString(bbb);
sf.WriteString(ccc);
sf.WriteString("ddd\r");// '\r' :0x0D
sf.Close();
CStdioFile sf2("test.txt",CFile::modeRead|CFile::typeText);
char buf[8];
CString str;
LPTSTR lpstr=sf2.ReadString(buf,8);
AfxMessageBox(buf);
while(sf2.ReadString(str))
AfxMessageBox(str);
sf2.Close();
CStdioFile sf;
if(!sf.Open(pFileName,CFile::modeCreate|CFile::modeReadWrite|CFile::typeText))
{
#ifdef _DEBUG
afxDump<<"Unable to open file"<<"\n";
#endif
exit(1);
}
char aaa[]="aaa\n";// '\n' :0x0A
char *bbb="bbb\12";// '\12':0x0A
CString ccc("ccc\15");// '\15':0x0D
sf.WriteString(aaa);
sf.WriteString(bbb);
sf.WriteString(ccc);
sf.WriteString("ddd\r");// '\r' :0x0D
sf.Close();
CStdioFile sf2("test.txt",CFile::modeRead|CFile::typeText);
char buf[8];
CString str;
LPTSTR lpstr=sf2.ReadString(buf,8);
AfxMessageBox(buf);
while(sf2.ReadString(str))
AfxMessageBox(str);
sf2.Close();