digitalmars.D.learn - phobos std.Stream.File incorrect open/wrong implementation
- Spacen Jasset (25/25) Oct 24 2008 I am trying to create a new file for writing, as a log file, like this:
- Spacen Jasset (4/37) Oct 24 2008 I've raised a bug for the wrong share mode.
I am trying to create a new file for writing, as a log file, like this:
new File("gltest.log", FileMode.OutNew);
and find that with any of the "write" options the file appears to be
opened for exclusive access on windows, so another process cannot then
read from the same file. Is there a way around this? Other than
continually opening and closing the log file, which also won't work
because then the log file can't be written to if it's being read from.
14:25:35 gltest.exe:5852 OPEN J:\bzr\gltest\trunk\gltest.log SUCCESS
Options: OpenIf Access: 00120196
I have also seen that readline like activity:
foreach (char[] line; input) {
will make system calls for one byte at a time? Is there no buffering in
the phobos lib?
14:25:35 gltest.exe:5852 OPEN J:\bzr\gltest\trunk\gltest.cfg SUCCESS
Options: Open Access: Read
14:25:35 gltest.exe:5852 QUERY INFORMATION
J:\bzr\gltest\trunk\gltest.cfg SUCCESS Length: 381
14:25:35 gltest.exe:5852 READ J:\bzr\gltest\trunk\gltest.cfg SUCCESS
Offset: 0 Length: 1
14:25:35 gltest.exe:5852 READ J:\bzr\gltest\trunk\gltest.cfg SUCCESS
Offset: 1 Length: 1
14:25:35 gltest.exe:5852 READ J:\bzr\gltest\trunk\gltest.cfg SUCCESS
Offset: 2 Length: 1
14:25:35 gltest.exe:5852 READ J:\bzr\gltest\trunk\gltest.cfg SUCCESS
Offset: 3 Length: 1
Oct 24 2008
Spacen Jasset wrote:
I am trying to create a new file for writing, as a log file, like this:
new File("gltest.log", FileMode.OutNew);
and find that with any of the "write" options the file appears to be
opened for exclusive access on windows, so another process cannot then
read from the same file. Is there a way around this? Other than
continually opening and closing the log file, which also won't work
because then the log file can't be written to if it's being read from.
14:25:35 gltest.exe:5852 OPEN J:\bzr\gltest\trunk\gltest.log
SUCCESS Options: OpenIf Access: 00120196
I have also seen that readline like activity:
foreach (char[] line; input) {
will make system calls for one byte at a time? Is there no buffering in
the phobos lib?
14:25:35 gltest.exe:5852 OPEN J:\bzr\gltest\trunk\gltest.cfg
SUCCESS Options: Open Access: Read
14:25:35 gltest.exe:5852 QUERY INFORMATION
J:\bzr\gltest\trunk\gltest.cfg SUCCESS Length: 381
14:25:35 gltest.exe:5852 READ
J:\bzr\gltest\trunk\gltest.cfg SUCCESS Offset: 0 Length: 1
14:25:35 gltest.exe:5852 READ J:\bzr\gltest\trunk\gltest.cfg
SUCCESS Offset: 1 Length: 1
14:25:35 gltest.exe:5852 READ J:\bzr\gltest\trunk\gltest.cfg
SUCCESS Offset: 2 Length: 1
14:25:35 gltest.exe:5852 READ J:\bzr\gltest\trunk\gltest.cfg
SUCCESS Offset: 3 Length: 1
I've raised a bug for the wrong share mode.
The workaround is to say: FileMode.OutNew | FileMode.In even if you
don't want to read from the file.
Oct 24 2008








Spacen Jasset <spacenjasset yahoo.co.uk>