phobos std.Stream.File incorrect open/wrong implementation

Spacen Jasset spacenjasset at yahoo.co.uk
Fri Oct 24 07:02:22 PDT 2008


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	


More information about the Digitalmars-d-learn mailing list