www.digitalmars.com         C & C++   DMDScript  

D - [BUG] std.file module is broken

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Using DMD 0.78, Windows 98SE.

The functions I have tried in the std.file module are not working at 
all.  As a result, I cannot use either the wc example or any of the 
simple test programs below.


D:\My Documents\Programming\D\Tests>infile
Error: in.txt: invalid handle

D:\My Documents\Programming\D\Tests>isfile

Error: in.txt: 120

D:\My Documents\Programming\D\Tests>outfile
Error: out.txt: invalid handle


The first two cases are the same whether or not the file exists.

Obviously this is a regression, considering that the website actually 
gives benchmarks for wc on some unspecified version.

Stewart.

-----infile.d-----
import std.file;

int main() {
         char[] text = cast(char[]) read("in.txt");

         printf(text);

         return 0;
}

-----isfile.d-----
import std.file;

int main() {
         if (isfile("in.txt")) {
                 printf("in.txt exists");
                 return 0;
         } else {
                 printf("in.txt doesn't exist");
                 return 1;
         }
}

-----outfile.d-----
import std.file;

int main() {
         write("out.txt", "Jackdaws love my big sphinx of quartz.");

         return 0;
}

-- 
My e-mail is valid but not my primary mailbox, aside from its being the 
unfortunate victim of intensive mail-bombing at the moment.  Please keep 
replies on the 'group where everyone may benefit.
Jan 15 2004
parent yaneurao <yaneurao_member pathlink.com> writes:
In article <bu5vna$1roe$1 digitaldaemon.com>, Stewart Gordon says...
Using DMD 0.78, Windows 98SE.
The functions I have tried in the std.file module are not working at 
all.  As a result, I cannot use either the wc example or any of the 
simple test programs below.

I had already reported this issue and how to fix. D/21781 yaneurao.
Jan 15 2004