下面的代码生成了一个TestFile.ini文件,打开后只能看到
黑色的方框几十个,还有a b c d ....等ASCII码我的原意是把1,2, 3 这些数据写入磁盘文件,打开.ini或.txt可以
看到 1,2 ,3 。。怎么改采好int i;
CFile file;
BOOL isOpen=FALSE;
isOpen=file.Open("C:\\TestFile.ini",CFile::modeCreate|CFile::modeReadWrite);
if(isOpen==FALSE)
{
AfxMessageBox("Can't open the file");
return ;
}
for(i=0;i<200;i++)
{
file.SeekToEnd();
file.Write(&i,sizeof(int));
}
file.Close();
黑色的方框几十个,还有a b c d ....等ASCII码我的原意是把1,2, 3 这些数据写入磁盘文件,打开.ini或.txt可以
看到 1,2 ,3 。。怎么改采好int i;
CFile file;
BOOL isOpen=FALSE;
isOpen=file.Open("C:\\TestFile.ini",CFile::modeCreate|CFile::modeReadWrite);
if(isOpen==FALSE)
{
AfxMessageBox("Can't open the file");
return ;
}
for(i=0;i<200;i++)
{
file.SeekToEnd();
file.Write(&i,sizeof(int));
}
file.Close();
不能直接写入int型吗?没有理由阿?请指点
这个类最好用,对于读写文件来说!
CFile::typeText只能用在派生类