prog3.cpp

来自「C++语言程序设计题典」· C++ 代码 · 共 16 行

CPP
16
字号
#include <fstream.h>
#include <iostream.h>
void main()
{
	char ch;
	fstream file("stud.dat",ios::in|ios::out);
	file << "abcdefghijk";
	file.seekp(0,ios::end);
	int size=file.tellp();
	cout << "文件大小:" << size << "字节" << endl;
	size=size/2;
	file.seekp(size);
    cout << "位置" << size << "处字符:" << (ch=file.get()) << endl;
    file.close();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?