[fpc-pascal]blockread in a procedure
Michael.VanCanneyt at Wisa.be
Michael.VanCanneyt at Wisa.be
Sun Feb 29 12:37:52 CET 2004
On Sun, 29 Feb 2004, David Emerson wrote:
> Hi there,
>
> I'm having trouble using blockread. It was working for... oh, a year... and all of a sudden it's not working. I'm getting a runtime error 87 in win32/i386 (fpc 1.0.10) and an error 217 in linux/i386 (fpc 1.0.6). Since I always compile with -gl it tells me it's failing right at blockread. Here's the code...
>
>
> const
> test_file_name = 'test.txt';
> the_source : ansistring = '';
>
> procedure read_source_file;
>
> const
> bufsize = 2048;
> var
> source_file : file;
> buf : array [1..bufsize] of char;
> count_read : longint; // longint required by blockread
>
> begin
>
> write ('Reading source file.....');
> assign (source_file, test_file_name);
> reset (source_file);
> the_source := '';
> repeat
> blockread (source_file, buf, bufsize, count_read);
> the_source := the_source + copy (buf, 1, count_read);
> until count_read = 0;
> close (source_file);
> the_source := the_source + chr(255);
> writeln ('Source file successfully read');
>
> end;
>
> begin
> read_source_file;
> end.
>
>
> If I get rid of the procedure read_source_file and put its code directly into the main
> "begin end." then it works. So for some reason, suddenly it can't stand having blockread
> inside a procedure. I haven't touched the procedure or any of the constants/variables
> associated with it in a long time, so it's bizarre that it suddenly decided to fail.
did you change the compiler, or one of the compiler flags ?
>
>
> Incidentally, fpc 1.0.10 rpm failed to install on redhat. I struggled with it for a good hour. Any tips? Does the gz work better than the rpm?
What error do you get ? What version of rpm do you use ?
If the .rpm fails, the .gz should always install.
Michael.
More information about the fpc-pascal
mailing list