{steinsoft.net}
 
 
 
 
 
Home/News
Code Snippets
Board
Projects
What's That?
I am using it actively
I planning to use/learn it
I don't plan to lean/use it
5th option
Leipzig
Home :: Programming :: Code Snippets :: Delphi :: Writing to a textfile

[ Writing to a textfile ]

Have you ever wondered how to write in textfile without using a Memo or a Richedit? Here is the answer:

procedure WriteTXT(Sender: TObject);
var
  text: textfile;
begin
  assignfile(text,'filename.txt');  // Open file filename.txt 
  // If the file already exists you can:
  Reset(text); // erase the content of the file
  // or you can:
  // Rewrite(file); delete the file and recreate it
  Write(text,'Hello World'); // Adds 'Hello World' in the textfile
  WriteLn(text,'Shalom World'); // Feeds line and adds 'Shalom World'
  closefile(text); // Closes the file (IMPORTANT)
end;

If you have any questions, feel free to ask them in the message board. You can also visit my homepage - www.seck.lu - for some Delphi software written by me.

 Last edited 2003-04-05 19:16:16 by David Seck - printable version
» copyright by andré stein
» using stCM v1.0
» steinsoft.net revision 5.0