MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000078Soldat Dedicated ServerScripting Corepublic2011-10-02 12:472012-08-23 21:18
Reportertk 
Assigned ToFalcon 
PrioritynormalSeverityminorReproducibilityN/A
StatusclosedResolutionwon't fix 
Platformx86OSWindowsOS Version7
Product Version 
Target VersionFixed in Version 
Summary0000078: ReadFile fails with reading binary files
DescriptionReadfile cuts result string while reading a binary file.
Steps To Reproduceprocedure ActivateServer;
var file: string;
begin
  file := ReadFile('maps/Arena.PMS');
  WriteLn(IntToStr(Length(file)));
end;

Output: 76
TagsNo tags attached.
John
Attached Files

- Relationships

-  Notes
(0001195)
Quantifier (reporter)
2011-10-06 15:31

This is correct behaviour when reading files in text mode. Byte 0x1A marks the end of file.
(0001198)
DorkeyDear (reporter)
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 (administrator)
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 (reporter)
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 (administrator)
2012-05-25 20:53

If you have requests for features please use the forums instead.
The bugtracker is only for bugfixes.
(0001577)
Falcon (administrator)
2012-08-23 21:18

since many scripts rely on readfile's line ending conversion, this function cannot be modified to read binary files.

- Issue History
Date Modified Username Field Change
2011-10-02 12:47 tk New Issue
2011-10-06 15:31 Quantifier Note Added: 0001195
2011-10-07 23:23 DorkeyDear Note Added: 0001198
2012-02-29 20:14 Falcon Assigned To => Falcon
2012-02-29 20:14 Falcon Status new => assigned
2012-05-24 20:47 Falcon Note Added: 0001519
2012-05-24 20:47 Falcon Status assigned => feedback
2012-05-25 09:00 DorkeyDear Note Added: 0001526
2012-05-25 20:53 Shoozza Note Added: 0001530
2012-08-23 21:18 Falcon Note Added: 0001577
2012-08-23 21:18 Falcon Status feedback => closed
2012-08-23 21:18 Falcon Resolution open => won't fix


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker