digitalmars.D.bugs - Error in std.stream
- BCS (21/21) Aug 04 2005 import std.stream;
- Ben Hinkle (10/31) Aug 04 2005 I can't reproduce the error on either Windows or Linux using dmd.128 - c...
- Derek Parnell (7/9) Aug 04 2005 It failed for me using Windows XP and DMD 0.128
- Ben Hinkle (2/4) Aug 05 2005 OK - I got it now. I reset my dmd setup and was able to reproduce it. My...
- Derek Parnell (7/33) Aug 04 2005 You are trying to set the file position to -1. The first position is zer...
import std.stream;
void main()
{
Stream ins = new BufferedFile(__FILE__, FileMode.In);
assert(ins.seekable);
ulong spot = ins.position-1;
printf("peek \"%.*s\"\n", ins.readLine());
ins.seek(spot, SeekPos.Set);
ins.position = spot;
}
/*
what's wrong with this program????
compiles fine, asserts work.
when run prints:
---
peek "import std.stream;"
Error: unable to move file pointer
---
It appears that BufferedFile is seekable (the assert at least
claims it is) but when I try to seek on it, the seek fails.
*/
Aug 04 2005
In article <dcum8v$1ihb$1 digitaldaemon.com>, BCS says...
import std.stream;
void main()
{
Stream ins = new BufferedFile(__FILE__, FileMode.In);
assert(ins.seekable);
ulong spot = ins.position-1;
printf("peek \"%.*s\"\n", ins.readLine());
ins.seek(spot, SeekPos.Set);
ins.position = spot;
}
/*
what's wrong with this program????
compiles fine, asserts work.
when run prints:
---
peek "import std.stream;"
Error: unable to move file pointer
---
It appears that BufferedFile is seekable (the assert at least
claims it is) but when I try to seek on it, the seek fails.
*/
I can't reproduce the error on either Windows or Linux using dmd.128 - can you
give more details about your setup?
Another odd detail is that I would expect to be able to reproduce it since you
are asking to set the file pointer to pos = -1. The reason is that when you
create a new BufferedFile the position is at 0 and so position-1 is -1. Then the
code reads a line and tries to set the position to -1 cast to a ulong which is
far outside the range of the actual file data. I'd have to look up the doc for
each platform to see what happens when you try to do that.
-Ben
Aug 04 2005
On Fri, 5 Aug 2005 03:48:22 +0000 (UTC), Ben Hinkle wrote:In article <dcum8v$1ihb$1 digitaldaemon.com>, BCS says...[snip]I can't reproduce the error on either Windows or Linux using dmd.128It failed for me using Windows XP and DMD 0.128 -- Derek Melbourne, Australia 5/08/2005 3:32:03 PM
Aug 04 2005
OK - I got it now. I reset my dmd setup and was able to reproduce it. My phobos.lib was in a bad state.I can't reproduce the error on either Windows or Linux using dmd.128It failed for me using Windows XP and DMD 0.128
Aug 05 2005
On Fri, 5 Aug 2005 03:26:23 +0000 (UTC), BCS wrote:
import std.stream;
void main()
{
Stream ins = new BufferedFile(__FILE__, FileMode.In);
assert(ins.seekable);
ulong spot = ins.position-1;
printf("peek \"%.*s\"\n", ins.readLine());
ins.seek(spot, SeekPos.Set);
ins.position = spot;
}
/*
what's wrong with this program????
compiles fine, asserts work.
when run prints:
---
peek "import std.stream;"
Error: unable to move file pointer
---
It appears that BufferedFile is seekable (the assert at least
claims it is) but when I try to seek on it, the seek fails.
*/
You are trying to set the file position to -1. The first position is zero
though.
--
Derek
Melbourne, Australia
5/08/2005 3:28:40 PM
Aug 04 2005









"Ben Hinkle" <bhinkle mathworks.com> 