As @rj; pointed out here, many file functions can not be used with forms. This is because these functions are not thread-safe.
File.simba, attached, solves this issue by overriding all file functions, such as OpenFile(), CreateFile(), WriteFileString(), etc using a TFileStream.
Examples:
Simba Code:
_Handle := CreateFile('C:\Users\****\Desktop\Hello world.txt');
If _Handle <> -1 Then
Begin
WriteFileString(_Handle, 'Foo bar');
CloseFile(_Handle); //~ Remember to always close your file!
End;
Simba Code:
_Handle := OpenFile('C:\Users\****\Desktop\Hello world.txt');
If _Handle <> -1 Then
Begin
ReadFileString(_Handle, _String, FileSize(_Handle));
WriteLN(_String);
CloseFile(_Handle);
End;
Simba Code:
_Handle := RewriteFile('C:\Users\****\Desktop\Hello world.txt');
If _Handle <> -1 Then
Begin
WriteFileString(_Handle, 'http://villavu.com');
CloseFile(_Handle);
End;
Simba Code:
_Handle := OpenFile('C:\Users\****\Desktop\Hello world.txt');
If _Handle <> -1 Then
Begin
_Size := FileSize(_Handle);
WriteLN('The file size is: ', _Size);
CloseFile(_Handle);
End;
Etc...
Thought it might be handy. Could be a hell of a lot shorter (and better written), but I've got better things to work on. .
Edit: I should mention that I haven't really tested it, but I don't see why it wouldn't work. Main thing I haven't tested is having multiple files open at once, and closing them, etc.