wex14_26.cpp
来自「数据结构C++代码,经典代码,受益多多,希望大家多多支持」· C++ 代码 · 共 41 行
CPP
41 行
#include <iostream.h>
#pragma hdrstop
#include "ptf.h"
void main(void)
{
PascalTextFile pfin, pfout;
char name[] = "PascalTextFile";
char buffer[32];
// write to file "P_out"
pfout.Assign("P_out");
pfout.Rewrite();
// write the characters of name + NULL
// character to file and close it
pfout.PWrite(name, strlen(name)+1);
pfout.Close();
// read from file "P_out"
pfin.Assign("P_out");
pfin.Reset();
// read the string back and test EndOfFile
for(;;)
{
pfin.PRead(buffer,strlen(name)+1);
if (pfin.EndFile())
break;
cout << buffer << endl;
}
}
/*
<Run>
PascalTextFile
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?