SRL Archive - Help and Support

File I/O?


Krichevskoy

2006-05-20 12:44:25

I'm sorry, I'm not very good at Delphi and I'm certainly worse at SCAR-Pascal :(
I started attempting to put together a SCAR port of a Markov chain script when I realized that I will need either
1) the ability to read from a sample chat log file (user-provided preferably, for uniqueness)
2) expectation that users will edit the script every time they use it to add a new giant string

So..what kind of I/O does SCAR have?

Avaphi

2006-05-20 13:09:09

I know pascal, You can readln from a different file, You can create a file and you can write to a file, Here is a link, check it out http://www.taoyue.com/tutorials/pascal/contents.html somewhere near the middle it talks about I/O

Renax

2006-05-20 15:41:15

WriteFileString and ReadFileString should work for your puposes.

WT-Fakawi

2006-05-22 04:07:35

I haven't discovered any specific SCAR related advanced File I/O routines. there are some but not many:

function WriteFileByte(FileNum: Integer; b: Byte): Boolean;
function WriteFileInt(FileNum: Integer; i: Integer): Boolean;
function WriteFileString(FileNum: Integer; s: string): Boolean;
function ReadFileByte(FileNum: Integer; var b: Byte): Boolean;
function ReadFileInt(FileNum: Integer; var i: Integer): Boolean;
function ReadFileString(FileNum: Integer; var s: string; Length: Integer): Boolean;
procedure CloseFile(FileNum: Integer);
function EndOfFile(FileNum: Integer): Boolean;
function FileSize(FileNum: Integer): LongInt;
function OpenFile(Path: string; Shared: Boolean): Integer;
function RewriteFile(Path: string; Shared: Boolean): Integer;

I havent found Pointer related or Position related functions, but maybe that Delphi has? Not familiair with Delphi though. Will start on this one of these days…..