comparison dmd/File.d @ 174:af724d3510d7

lot os toCBuffer methods implemented moved shared Type.* stuff into Global
author korDen
date Sun, 10 Oct 2010 03:47:23 +0400
parents e28b18c23469
children e3afd1303184
comparison
equal deleted inserted replaced
173:d237b38b5858 174:af724d3510d7
18 import core.sys.posix.utime; 18 import core.sys.posix.utime;
19 import core.stdc.stdio; 19 import core.stdc.stdio;
20 } 20 }
21 21
22 import std.string : toStringz; 22 import std.string : toStringz;
23 import std.stdio;
23 24
24 import core.memory; 25 import core.memory;
25 26
26 class File 27 class File
27 { 28 {
82 { 83 {
83 int result = 0; 84 int result = 0;
84 85
85 string name = this.name.toChars(); 86 string name = this.name.toChars();
86 87
87 //printf("File::read('%s')\n",name); 88 //writefln("File::read('%s')\n",name);
88 int fd = open(toStringz(name), O_RDONLY); 89 int fd = open(toStringz(name), O_RDONLY);
89 if (fd == -1) { 90 if (fd == -1) {
90 result = errno; 91 result = errno;
91 printf("file: %s\n", toStringz(name)); 92 printf("file: %s\n", toStringz(name));
92 printf("\topen error, errno = %d\n", errno); 93 printf("\topen error, errno = %d\n", errno);
152 DWORD numread; 153 DWORD numread;
153 HANDLE h; 154 HANDLE h;
154 int result = 0; 155 int result = 0;
155 156
156 string name = this.name.toChars(); 157 string name = this.name.toChars();
157 //std.stdio.writeln("Open file ", name); 158 //writeln("Open file ", name);
158 159
159 h = CreateFileA(toStringz(name), GENERIC_READ, FILE_SHARE_READ, null, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, HANDLE.init); 160 h = CreateFileA(toStringz(name), GENERIC_READ, FILE_SHARE_READ, null, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, HANDLE.init);
160 if (h == INVALID_HANDLE_VALUE) { 161 if (h == INVALID_HANDLE_VALUE) {
161 goto err1; 162 goto err1;
162 } 163 }