1、利用MFC库
CFile
CFileFind
CArchive
CStdioFile
CSharedFile sf(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT)
CMemFile sf(,)
2、C语言
FILE*fp;
char ch;
if((fg=fopen(“fileName.txt”,“r”))==NULL)
{
fputc
ch=fgetc(fp);
}
3、C++
| l类名 | 作用 | 在哪个 头文件中 |
|---|---|---|
| ios | 抽象基类 | iostream |
| istream | 通用输入流和其他输入流基类 | iostream |
| ostream | 通用输出流和其他输出流基类 | iostream |
| iostream | 通用输入输出流和其他输入输出流基类 | iostream |
| ifstream | 输入文件流 | fstream |
| ofstream | 输出文件流 | fstream |
| fstream | 输入输出文件流 | fstream |
| istrstream | 输入字符串流 | strstream |
| ostrstream | 输出字符串流 | strstream |
| strstream | 输入输出字符串流 | strstream |
写ASCII文件
#include <fstream>
void fun()
{
std::ofstream ofs;
ofs.open("fileName");
ofs<<vel1<<std::endl
ofs.close();
}
写二进制文件 read和write
std::ofstream ofs;
版权声明:本文为zhoufei95原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。