第一个文件只是一个字符串列表。
我怎样才能去掉帕斯卡添加的空白?
program Wiki; {$mode objfpc} TYPE wiki=record title:string; description:string; end; var f:text ; g:file of wiki ; row:wiki; fileName: string; oldFileName:string; begin writeln('Old file name:'); readln(oldFileName); ASSIGN(f,oldFileName); RESET(f); writeln('New file name:'); readln(fileName); ASSIGN(g,fileName); REWRITE(g); REPEAT Readln(f,row.title); writeln('give a description:'); Writeln(row.title); Readln(row.description); Write(g,row) until EOF(f); CLOSE(f); CLOSE(g); writeln; writeln('press enter to close.'); readln(); end.
在 objfpc 无模式 {$H+} ,我猜是的 row.description 是一个固定大小的涡轮帕斯卡风格 ShortString
objfpc
{$H+}
row.description
ShortString
而是将输出文件写入文本文件:
var f: Text; g: Text;
以及:
Writeln(g, row.title, ';', row.description);
产生如下文本输出:
Finding Nemo;The adventures of two fish trying to find the lost son of one of them Toy Story;The adventures of a merry bunch of toys
等。