- 1、本文档共12页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
delphi文本文件读写完整操作(Delphi text file read and write complete operation)
delphi文本文件读写完整操作(Delphi text file read and write complete operation)
Delphi text file to read and write
Delphi supports three file types: text files, log files, no file type.
Text file is in units of reading and writing. Because of the length of every line is not necessarily the same, can not calculate the exact location of a given line in the file, so we can only read and write sequence.
The text file only for read or write open in an open text simultaneously is not allowed to read and write operations.
Text file open requires two steps: 1. file variables and initializes the read and write file name; 2.
Correlation of 1. variables and file file name:
AssignFile (VarTxt, FileName);
If you omit the FileName path will default to the current directory.
2. initializes the read and write in three ways:
(1) Reset: read-only open, a pointer to the file header;
(2) Rewrite: to create a new file and open, write only;
(3) Append: from the tail of an additional pointer at the end of the file.
The file does not exist when using Reset or Append will cause a I/O exception.
Finally use CloseFile to close the file.
In order to maintain compatibility, Delphi also allows the user to associate with Assign, close the file with Close.
--------------------------------------------------------------------------------
Read / write sample:
Unit Unit1;
Interface
Uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
Type TForm1 = class (TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Procedure Button1Click (Sender: TObject);
Procedure Button2Click (Sender: TObject);
Procedure Button3Click (Sender: TObject);
Procedure Button4Click (Sender: TObject);
Procedure Button5Click (Sender: TObject);
Procedure Button6Click (Sender: TObject);
Procedure Button7Click (Sender: TObject);
Private {Private declarations}
Public {Public declarations}
End;
Var Form1: TForm
您可能关注的文档
- c++错误信息提示(C++ error message prompt).doc
- c++颜色变换程序(C++ color transformation program).doc
- c1倒桩移库技巧口诀(Our C1 skills transfer formula).doc
- c++标准库stl容器简介(C++ standard library STL container profile).doc
- c++类的例题(Examples of class c++).doc
- c8051f9xx系列单片机读写片内flash源码(C8051F9XX Series Singlechip read and write flash source code).doc
- c8051f060读写eeprom芯片24lc256源程序(C8051F060 read and write EEPROM chip 24lc256 source).doc
- cad 材质库汉化中英翻译(CAD material library finished Chinese English translation).doc
- cad 实训八(cad 实训八).doc
- cad2009常用快捷键列表(Cad2009 list of commonly used shortcut keys).doc
- 2025年成都市委办公厅、市委保密机要局所属事业单位选调4人笔试备考题库及参考答案详解一套.docx
- 2025年柳州市城中区人民法院招录聘用(二)笔试备考题库及参考答案详解.docx
- 2025年广东省特种设备检测研究院汕头检测院第一批招聘笔试备考题库及参考答案详解一套.docx
- 2025年广东广州市越秀区农林街招聘辅助人员笔试备考题库附答案详解.docx
- 2025年山东第一医科大学附属肿瘤医院(山东省肿瘤防治研究院、山东省肿瘤医院)招聘博士研究生工作人员.docx
- 2025年春季云南省教育厅招募银龄教师1135人支持职业教育笔试备考题库及答案详解一套.docx
- 2025年徐州市事业单位定向招聘退役大学生士兵10人笔试备考题库附答案详解.docx
- 2025年新疆师范大学招聘35人笔试高频难、易错点备考题库及完整答案详解1套.docx
- 2025年成都市公园城市建设管理局所属事业单位选调7人笔试备考题库参考答案详解.docx
- 2025年广西区体育彩票管理中心招聘5人笔试备考题库带答案详解.docx
文档评论(0)