Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: DorkeyDear on August 04, 2009, 08:38:43 pm

Title: ReadFile
Post by: DorkeyDear on August 04, 2009, 08:38:43 pm
It appears that ReadFile bugs up once it hits Chr(26) (SUB). I'm wondering if there is a place specific for scripting core bugs, or even server bugs, because I don't feel Script Core Suggestions is the right place to report this.

Code: (pascal) [Select]
procedure ActivateServer();
var
  MyString: string;
begin

  MyString := 'start' + #026 + 'notstart';
  WriteLn('write file string length to ' + InttoStr(Length(MyString)));
  WriteFile('./test.txt', MyString);

  MyString := '';
  MyString := ReadFile('./test.txt');
  WriteLn(' read file string length is ' + InttoStr(Length(MyString)));

  WriteFile('./test.txt', MyString);
  WriteLn('    wrote copy of read file');

  MyString := '';
  MyString := ReadFile('./test.txt');
  WriteLn(' read file string length is ' + InttoStr(Length(MyString)));

end;

And while I'm at it, the \r\n extra at the end is pretty annoying. If we didn't put it there, it should mean we don't want it!
Title: Re: ReadFile
Post by: CurryWurst on August 05, 2009, 03:52:56 am
And while I'm at it, the \r\n extra at the end is pretty annoying. If we didn't put it there, it should mean we don't want it!

For further information about this problem click here (http://forums.soldat.pl/index.php?topic=32817)
Title: Re: ReadFile
Post by: DorkeyDear on August 05, 2009, 01:18:05 pm
For further information about this problem click here (http://forums.soldat.pl/index.php?topic=32817)
In regards to that, if I have a \r\n at the end of the file, it will not add an extra \r\n.
But that's not the main point of this topic :P
Title: Re: ReadFile
Post by: Quantifier on September 08, 2009, 04:30:11 am
That's actually a feature in the OS, for reading in text mode.
Traditionally character #26 (0x1A or ^Z) is used as End-Of-File marker.