Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-10

TFileStream.Seek Bug in 1.1 ??

5 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Judison

Hi,

First excuse my poor english...

I downloaded the last version from CVS today (October 30) and then, after install it, I can't compile my project, because of (I think) a bug in TFileStream.Seek, there is a example of the error:

program test_stream;
uses Classes;
var
  Stream: TStream;
begin
  Stream := TFileStream.Create('test_stream.pas', fmOpenRead);
  WriteLn(Stream.Position);
  Stream.Free;
end.
$ ppc386 -S2 test_stream.pas
$ ./test_stream

And then I get a Access violation when I try to access Stream.Position or Stream.Seek (GetPosition does a Seek)... In case o TFileStream (THandleStream) is a FileSeek...

I will try to do a FileOpen and FileSeek, to see where is the error... But tomorrow, now I go to sleep... :)
And I'm starting to think that I'm doing something wrong...

TIA
your friend,
Judison

Reply by email

Unknown author
Show quoted text 11 lines
program test_stream; uses Classes; var Stream: TStream; begin Stream := TFileStream.Create('test_stream.pas', fmOpenRead); WriteLn(Stream.Position); Stream.Free; end.

This works in Delphi 5 Sp2. I wonder if the file is 'locked' by the OS? Which OS are you using, sorry I forgot to look. Try opening a different file. Try 'fmCreate' a new file. If that works, it could be the OS locking the file.

Matt

---------------------------------------------
This message was sent using Mistral WebMail.
http://www.mistral.co.uk/

Reply by email

Peter Vreman
to Unknown author
Show quoted text 18 lines
> program test_stream; > > uses Classes; > > var > Stream: TStream; > begin > Stream := TFileStream.Create('test_stream.pas', fmOpenRead); > WriteLn(Stream.Position); > Stream.Free; > end. This works in Delphi 5 Sp2. I wonder if the file is 'locked' by the OS? Which OS are you using, sorry I forgot to look. Try opening a different file. Try 'fmCreate' a new file. If that works, it could be the OS locking the file.

Test first if the program works with fpc 1.0.x. If it works then it's a bug in 1.1.

Reply by email

Michael Van Canneyt
to Unknown author: This works in Delphi 5 Sp2. I wonder if the file is 'locked' by the OS? Which OS are you…
Show quoted text 15 lines
> program test_stream; > > uses Classes; > > var > Stream: TStream; > begin > Stream := TFileStream.Create('test_stream.pas', fmOpenRead); > WriteLn(Stream.Position); > Stream.Free; > end. This works in Delphi 5 Sp2. I wonder if the file is 'locked' by the OS? Which OS are you using, sorry I forgot to look. Try opening a different file. Try 'fmCreate' a new file. If that works, it could be the OS locking the file.

No, there IS a bug in the compiler which makes this bomb out. It has been discovered by someone else as well.

Michael.

Reply by email

Michael Van Canneyt
to Peter Vreman: Test first if the program works with fpc 1.0.x. If it works then it's a bug in 1.1.
Peter Vreman wrote 21 lines
>> program test_stream; >> >> uses Classes; >> >> var >> Stream: TStream; >> begin >> Stream := TFileStream.Create('test_stream.pas', fmOpenRead); >> WriteLn(Stream.Position); >> Stream.Free; >> end. > > This works in Delphi 5 Sp2. I wonder if the file is 'locked' by the OS? > Which > OS are you using, sorry I forgot to look. Try opening a different file. > Try 'fmCreate' a new file. If that works, it could be the OS locking the > file. > Test first if the program works with fpc 1.0.x. If it works then it's a bug in 1.1.

This IS a bug in 1.1 see my mail to the core list. The same code works in 1.0, not in 1.1

Michael.

Reply by email