12.cpp

来自「C++制作的简单的文字游戏」· C++ 代码 · 共 30 行

CPP
30
字号
#include <iostream>
#include <fcntl.h>
#include <io.h>
using namespace std;
void mapshow(char* g)
{
	int point;
	int len;
	point=_open(g,_O_RDONLY);
	len=_filelength(point);
	_close(point);
	char* play=new char[len];
	FILE *pfile;
	pfile=fopen(g,"rb");
	fread(play,len,1,pfile);
	fclose(pfile);
	int i=0;
	while(i<len)
	{
		cout<<play[i];
		i++;
	}
	cout<<endl;
	delete[] play;
}
void main()
{
	mapshow("西安.txt");
}

⌨️ 快捷键说明

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