MFC中对文件操作的类

xiaoxiao2021-02-27  509

提供的类CFile::Cfile()

读文件:

CFile file("7.txt",CFile::modeRead); char *pBuf; DWORD dwFileLen; dwFileLen=file.GetLength(); pBuf=new char[dwFileLen+1];     pBuf[dwFileLen]=0; file.Read(pBuf,dwFileLen); file.Close(); MessageBox(pBuf);

写文件:

CFile file("7.txt",CFile::modeCreate|CFile::modeWrite); file.Write("dong_yanzhi",strlen("dong_yanzhi")); file.Close();

转载请注明原文地址: https://www.6miu.com/read-2340.html

最新回复(0)