Chr(13) is new line.
SCAR Code:
File functions
function OpenFile(Path: string; Shared: Boolean): Integer;
Opens file for reading and returns file number if successful or negative number if failed. If shared = true then attempts to open files used by other applications as read-only.
function RewriteFile(Path: string; Shared: Boolean): Integer;
Opens file for writing and truncates it. Returns file number if successful or negative number if error.
procedure CloseFile(FileNum: Integer);
Closes file specified by FileNum.
function EndOfFile(FileNum: Integer): Boolean;
Returns true if end of file specified by FileNum reached.
function FileSize(FileNum: Integer): LongInt;
Returns file size in bytes.
function WriteFileByte(FileNum: Integer; b: Byte): Boolean;
Writes a single byte to file.
function WriteFileInt(FileNum: Integer; i: Integer): Boolean;
Writes a single integer to file.
function WriteFileString(FileNum: Integer; s: string): Boolean;
Writes a string to file.
function ReadFileByte(FileNum: Integer; var b: Byte): Boolean;
Reads a single byte from file.
function ReadFileInt(FileNum: Integer; var i: Integer): Boolean;
Reads a single integer from file.
function ReadFileString(FileNum: Integer; var s: string; Length: Integer): Boolean;
Reads Length number of bytes from file into string s.
procedure WriteINI(Section, KeyName, NewString, FileName: string);
Writes data to an ini-structured file.
Structure:
[Section]
KeyName=NewString
function ReadINI(Section, KeyName, FileName: string): string;
Reads data from an ini-structured file.
Structure:
[Section]
KeyName=SomeString
procedure DeleteINI(Section, KeyName, FileName: string);
Deletes a KeyName from an INI file and if you pass an empty string as KeyName it will delete then entire Section.
function DirectoryExists(Directory: string): Boolean;
Returns true if the directory exists.
function FileExists(FileName: string): Boolean;
Returns true if the file exists.
function ExtractFileName(FileName: string): string;
Returns the name of a file from a string.
Example:
C:\somefolder\somefile.ext => somefile.ext
function ExtractFilePath(FileName: string): string;
Returns the filepath from a string.
Example:
C:\somefolder\somefile.ext => C:\somefolder\
function ExtractFileExt(FileName: string): string;
Returns the file extension from a string.
Example:
C:\somefolder\somefile.ext => .ext
function ExtractFileDrive(FileName: string): string;
Returns the file drive from a string.
Example:
C:\somefolder\somefile.ext => C:
function GetFiles(Path, Ext: string): TStringArray;
Returns the files in a directory.
function SaveToFile(Sender: TObject; FileName: string): Boolean;
Saves the content of certain objects:
TStrings, TStringList, TBitmap, TImage, TPicture, TMemo, TListBox, TComboBox, TRichEdit, TCheckListBox, TGraphic
Returns True if the saving was succesful.
function LoadFromFile(Sender: TObject; FileName: string): Boolean;
Loads the content of certain objects:
TStrings, TStringList, TBitmap, TImage, TPicture, TMemo, TListBox, TComboBox, TRichEdit, TCheckListBox, TGraphic
Returns True if the loading was succesful.
function MD5FromFile(Filepath: string): string;
Returns the MD5 hash value of a file.