Saving a message to the text file.
function Protocol(sMsg, sFileName: string; bDateTimeStamp: boolean; iEncodingType: integer): int64;
Parameter |
Type |
Value |
---|---|---|
sMsg |
string |
message text; |
sFileName |
string |
full path to the log file with a name and extension; |
bDateTimeStamp |
boolean |
add the date and time stamps to the message, if necessary. |
iEncodingType |
integer |
file encoding type, number. |
>=0 |
no errors, file file size; |
1 |
error writing to file, error when creating a new file or the specified path is invalid. |
var
i, iVal, iResult: int64;
begin
iVal := 12; // будем вычислять факториал числа 12
iResult := 1;
for i := 2 to iVal do begin // цикл вычисления факториала
iResult := iResult * i;
Protocol(inttostr(i) + ' - ' + inttostr(iResult), 'c:\temp\factorial.log', true, 0);
end;
end.