asdqwe
05-28-2007, 03:07 AM
Hi guys.
I'm trying to write data to a file with certain format
Here's my code
procedure WriteCardsDataToFile;
var k : byte;
begin
// The location for the file we are creating.
fileLocation := 'C:\data.txt';
// Sets OutFile to Create a file and if it creates it successfully it returns
// a file number. False because this file isn't being shared by any app.
OutFile := ReWriteFile(fileLocation, False);
// Write
for k:=1 to 10 do
if (k=8) then
WriteFileString(OutFile, cardsFounds_Name[k] + ' ' + CHR(13))
else
WriteFileString(OutFile, cardsFounds_Name[k] + ' ');
// Close the file OutFile.
CloseFile(OutFile);
// Writes a successful message since it worked!
WriteLn('You''ve successfully created the file!');
end;
Now I'm pretty sure that CHR(13) is carriage return / ENTER or we can usually use /r/n to do that, but it seems doesn't work with SCAR...
Anyone know how to add ENTER when writing to a file?
Is there a function called WriteLnFileString ?? :D
Cheers
I'm trying to write data to a file with certain format
Here's my code
procedure WriteCardsDataToFile;
var k : byte;
begin
// The location for the file we are creating.
fileLocation := 'C:\data.txt';
// Sets OutFile to Create a file and if it creates it successfully it returns
// a file number. False because this file isn't being shared by any app.
OutFile := ReWriteFile(fileLocation, False);
// Write
for k:=1 to 10 do
if (k=8) then
WriteFileString(OutFile, cardsFounds_Name[k] + ' ' + CHR(13))
else
WriteFileString(OutFile, cardsFounds_Name[k] + ' ');
// Close the file OutFile.
CloseFile(OutFile);
// Writes a successful message since it worked!
WriteLn('You''ve successfully created the file!');
end;
Now I'm pretty sure that CHR(13) is carriage return / ENTER or we can usually use /r/n to do that, but it seems doesn't work with SCAR...
Anyone know how to add ENTER when writing to a file?
Is there a function called WriteLnFileString ?? :D
Cheers