Author Topic: ReadFile  (Read 913 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
ReadFile
« 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!
« Last Edit: August 04, 2009, 08:42:12 pm by DorkeyDear »

Offline CurryWurst

  • Camper
  • ***
  • Posts: 265
    • Soldat Global Account System
Re: ReadFile
« Reply #1 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
Soldat Global Account System: #soldat.sgas @ quakenet

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: ReadFile
« Reply #2 on: August 05, 2009, 01:18:05 pm »
For further information about this problem click here
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

Offline Quantifier

  • Major
  • *
  • Posts: 70
Re: ReadFile
« Reply #3 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.