MantisBT - Soldat Dedicated Server
View Issue Details
0000078Soldat Dedicated ServerScripting Corepublic2011-10-02 12:472012-08-23 21:18
tk 
Falcon 
normalminorN/A
closedwon't fix 
x86Windows7
 
 
0000078: ReadFile fails with reading binary files
Readfile cuts result string while reading a binary file.
procedure ActivateServer;
var file: string;
begin
  file := ReadFile('maps/Arena.PMS');
  WriteLn(IntToStr(Length(file)));
end;

Output: 76
No tags attached.
Issue History
2011-10-02 12:47tkNew Issue
2011-10-06 15:31QuantifierNote Added: 0001195
2011-10-07 23:23DorkeyDearNote Added: 0001198
2012-02-29 20:14FalconAssigned To => Falcon
2012-02-29 20:14FalconStatusnew => assigned
2012-05-24 20:47FalconNote Added: 0001519
2012-05-24 20:47FalconStatusassigned => feedback
2012-05-25 09:00DorkeyDearNote Added: 0001526
2012-05-25 20:53ShoozzaNote Added: 0001530
2012-08-23 21:18FalconNote Added: 0001577
2012-08-23 21:18FalconStatusfeedback => closed
2012-08-23 21:18FalconResolutionopen => won't fix

Notes
(0001195)
Quantifier   
2011-10-06 15:31   
This is correct behaviour when reading files in text mode. Byte 0x1A marks the end of file.
(0001198)
DorkeyDear   
2011-10-07 23:23   
I hope to see support for reading binary functions in the future (whether this function or a new function).
(0001519)
Falcon   
2012-05-24 20:47   
Read status must stay binary unsafe due to fact that it converts line endings to CRLF so that they have alway same form in the script.
The only solution would be to add new, binary safe function.
(0001526)
DorkeyDear   
2012-05-25 09:00   
A new function that can read files binary-safely would be a sufficient solution. For the function name... ReadFileBinary, ReadFileBin, ReadFileB? 'Bin' keeps the overall function name not too long, and yet still more descriptive than simply 'B'.

Another option would be having a collection functions with similar behavior to fopen, fread, fwrite, fclose, fseek, etc. or similar. The user has the choice here to specify read/write/both, binary/non-binary, create (or not to) file if non-existent, specify write location (append/replace from scratch), etc. This may introduce additional features.
When writing this, I was referring to:
http://us3.php.net/manual/en/function.fopen.php [^]
http://msdn.microsoft.com/en-us/library/y973b725.aspx [^] (and links there-within)
(0001530)
Shoozza   
2012-05-25 20:53   
If you have requests for features please use the forums instead.
The bugtracker is only for bugfixes.
(0001577)
Falcon   
2012-08-23 21:18   
since many scripts rely on readfile's line ending conversion, this function cannot be modified to read binary files.