Registriert seit: 27. Apr 2011
242 Beiträge
Delphi 6 Enterprise
|
AW: Textinhalt aufsplitten
20. Mär 2012, 16:04
So geht es auch (Befehle wie AssignFile usw auch bitte angucken).
Quellcode von der Seite http://www.delphibasics.co.uk/RTL.asp?Name=WriteLn
Delphi-Quellcode:
var
myFile : TextFile;
text : string;
begin
// Try to open the Test.txt file for writing to
AssignFile(myFile, 'Test.txt');
ReWrite(myFile);
// Write a couple of well known words to this file
WriteLn(myFile, 'Hello World');
// Write a blank line
WriteLn(myFile);
// Write a string and a number to the file
WriteLn(myFile, '22/7 = ' , 22/7);
// Repeat the above, but with number formatting
WriteLn(myFile, '22/7 = ' , 22/7:12:6);
// Close the file
CloseFile(myFile);
// Reopen the file for reading
Reset(myFile);
// Display the file contents
while not Eof(myFile) do
begin
ReadLn(myFile, text);
ShowMessage(text);
end;
// Close the file for the last time
CloseFile(myFile);
end;
Mfg,
Coffeecoder
|
|
Zitat
|