and then execute the statement. On the network to collect some information, and then write a line to read TXT text file program, here and share with you. Procedure TForm1.Button1Click (Sender: TObject); V
//将帐号信息写入文本文件函数 procedure TForm1.WriteUserToText(user:String; pass:String); var txt:TextFile; begin //先判断一下文件是否存在, 不存在时就创建它 if not FileExists('C:\p.txt') then begin Assignfile(txt,'c:\p.txt'); //指定文件路径 rewrite(txt); //创建并打开一个新文件(或...
最好是直接用文件操作函数写入。给你写了个函数:procedure WriteTextFile(const TextFileName:String;content:TStrings);var txtfile:TextFile;i:Integer;beginif (content=nil) or (content.Count=0) then exit;AssignFile(txtfile,TextFileName);tryif FileExists(TextFileName) thenappend(txtfile)e...
Onthenetworktocollectsomeinformation,andthenwritea linetoreadTXTtextfileprogram,hereandsharewithyou. ProcedureTForm1.Button1Click(Sender:TObject); Var Thedefinitionoftextfiledatatypeinfi:TextFile;//system unit A1:string; I:integer; Strsql:string; ...
(first write file) Procedure TForm1.Button2Click (Sender: TObject); Var S: string; Begin AssignFile (F, FileName); Reset (F); / / open read only Readln (F, s); / / read ShowMessage (s); / / display: the first line Readln (F, s); / / continue to read ShowMessage (s); ...
Memo1.Lines.LoadFromFile ( TextFileName ) ; 这样在TMemo上所做的一切修改当调用Memo部件的SaveToFile方法后都会反映到文件中去。 1.2 记录文件 记录文件是一种操作更为灵活的文件类型。它允许同时为读和写打开,而且由于记录文件中每条记录的长度固定,所以可随机存取。
1.9、Write过程 作用:用于向一个文本文件写入数据。 原型:procedure Write( [var F: Text; ] P1 [ , P2,..., Pn] ); //文本类型文件 procedure Write(F, V1,…Vn); //有类型文件 F:文本文件比变量。 P1……Pn:代表向文件中写入的数据。
do begin // Write number of Columns/Rows Writeln(f, ColCount); Writeln(f, RowCount); // loop through cells for i := 0 to ColCount - 1 do for k := 0 to RowCount - 1 do Writeln(F, Cells[i, k]); end; CloseFile(F);end;// Load a TStri...
x_pLogFlag:=cfReadIniFile(X_cProgID,'Log_Flag','N'); end; //==写日志过程 procedurecpWriteLog(pFObject:string;pTxt:string;pMode:byte); var pMyFile:textFile; begin ifx_pLogFlag='N'thenexit; try AssignFile(pMyFile,pFObject); ifpMode=1thenpTxt:=DateTimeToStr(Now)+''+pTxt; ifx...
procedure TForm1.Button1Click(Sender: TObject);var s:TStringList; i,j:Integer; str1,str2:string;begin OpenDialog1.Execute; s:=TStringList.Create; s.Text:=Memo1.Text; //先给s值, str1:='插入值'; //我这里在有#号的位置的前面写上“插入值” str2:=s.Tex...