|
| Add Line into the end of a file |  
|
|---|
| Add line into the end | Product: Delphi all versions | Category: Files Operation | Skill Level:
 | Scoring:  | Last Update: 03/20/2003 | Search Keys: delphi delphi3000 article borland vcl code-snippet Add File End | Times Scored: 3 | Visits: 2113 | Uploader: Gilberto Saraiva Company: Qualita endoSOFT Ltda. | Reference: N/A | | | Question/Problem/Abstract:
You want to write a line in a large file, use this procedure to do this. | Answer:
procedure AddLine_InFile(sLine: String; const FilePath: string);
{
sLine = String that go to the end of file.
FilePath = FullPath of the file.
}
var
pLog: Textfile;
begin
try
AssignFile(pLog, FilePath); // Assing a Path to TextFile.
if not FileExists(FilePath) then // Check Existence.
Rewrite(pLog, FilePath); // If not Make a new file.
Append(pLog); // Set Current line as the end.
WriteLn(pLog, sLine); // Write sLine if file.
finally
CloseFile(pLog); // Close the file.
end;
end;
|
|
|
| |
Sign up to consume product discounts for Bronze memberships !
|
|
| |
Community Ad of C.A. Longen |
|
| |
|
|
|