【发布时间】:2020-06-22 16:15:21
【问题描述】:
我正在尝试用 free pascal 向文本文件中写入一些内容,但它没有写入任何内容。
这是我的代码:
program start;
uses crt;
type txt = file of string;
var
h : string;
f : txt;
begin
assign(f,'hey.txt');
rewrite(f);
h := 'jmhtdjh';
write(f,h);
close(f);
readkey;
end.
【问题讨论】:
-
@lurker:非常感谢 lurker,我已修复它,但它仍然无法正常工作。
-
这很奇怪。我可以编译你的程序,运行它,
hey.txt出现在当前文件夹中,内容为“jmhtdjh”。最后没有换行符,因此请确保检查命令提示符的前面,因为它将全部一起平滑。
标签: pascal file-handling freepascal