初学者(文件类型)

zhucezhennan2008 2008-12-25 10:55:21
type
student=record
mytextfile=file of student;
num:integer;
name:string;
age:byte;
sex:boolean;
birthplace:string;
end;

var
mytextfile:file of student;
begin
assignfile(mytextfile,'D:\myfile\file.txt');
Closefile(mytextfile);
end.


mytextfile=file of student; 这有什么问题?
...全文
55 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhucezhennan2008 2008-12-26
  • 打赏
  • 举报
回复
type
student=record
mytextfile=file of student;
num:integer;
name:string[10];
age:byte;
sex:boolean;
birthplace:string[20];
end;

var
mytextfile:file of student;
begin
assignfile(mytextfile,'D:\myfile\file.txt');
Closefile(mytextfile);
end.

着就可以了
为什么string[10] 要把占的字节数标出了呢?
qweqwewqewqe 2008-12-26
  • 打赏
  • 举报
回复
类型文件不能包括长字符
zhucezhennan2008 2008-12-25
  • 打赏
  • 举报
回复
文件类型
zhucezhennan2008 2008-12-25
  • 打赏
  • 举报
回复
type
TStudent = record
num :integer;
name :string;
age :byte;
sex :boolean;
birthplace:string;
end;

不写那句
但到var
mytextfile:file of student;
会报错
panrongzeng 2008-12-25
  • 打赏
  • 举报
回复
mytextfile=file of student;写这句你想搞什么类型?
没见过这种写法的
taste品味 2008-12-25
  • 打赏
  • 举报
回复
type
TStudent = record
num :integer;
name :string;
age :byte;
sex :boolean;
birthplace:string;
end;

不用那句

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧