Re: Download file via http

2011-12-13 Thread Kai Meyer
On 12/13/2011 11:10 AM, Regan Heath wrote: On Tue, 13 Dec 2011 17:58:57 -, Kai Meyer wrote: On 12/13/2011 10:39 AM, Vladimir Panteleev wrote: On Tuesday, 13 December 2011 at 17:29:20 UTC, Kai Meyer wrote: I get bytes_needed from the Content-Length header. The I get the correct number of

Re: Download file via http

2011-12-13 Thread Regan Heath
On Tue, 13 Dec 2011 17:58:57 -, Kai Meyer wrote: On 12/13/2011 10:39 AM, Vladimir Panteleev wrote: On Tuesday, 13 December 2011 at 17:29:20 UTC, Kai Meyer wrote: I get bytes_needed from the Content-Length header. The I get the correct number of bytes from the Content-Length, bytes_needed

Re: Download file via http

2011-12-13 Thread Kai Meyer
On 12/13/2011 10:39 AM, Vladimir Panteleev wrote: On Tuesday, 13 December 2011 at 17:29:20 UTC, Kai Meyer wrote: I get bytes_needed from the Content-Length header. The I get the correct number of bytes from the Content-Length, bytes_needed gets the right value, but the resulting file isn't right

Re: Download file via http

2011-12-13 Thread Vladimir Panteleev
On Tuesday, 13 December 2011 at 17:29:20 UTC, Kai Meyer wrote: I get bytes_needed from the Content-Length header. The I get the correct number of bytes from the Content-Length, bytes_needed gets the right value, but the resulting file isn't right. The file has the right number of bytes, but I a

Download file via http

2011-12-13 Thread Kai Meyer
I've been trying to modify the htmlget.d example for std.socketstream (http://www.d-programming-language.org/phobos/std_socketstream.html) to be able to download a file. My code ends up looking like this at the end: auto outfile = new std.stream.File(destination, FileMode.Out);

Re: Read text file, line by line?

2011-12-13 Thread Jonathan M Davis
On Tuesday, December 13, 2011 14:08:14 Robert Clipsham wrote: > On 13/12/2011 13:58, Iain S wrote: > > How would one achieve this in D2? I have tried for a couple of hours > > now and have achieved nothing but stress. > > import std.stdio; > > void main() { > foreach(line; File("myTextFile.

Re: Read text file, line by line?

2011-12-13 Thread Robert Clipsham
On 13/12/2011 13:58, Iain S wrote: How would one achieve this in D2? I have tried for a couple of hours now and have achieved nothing but stress. import std.stdio; void main() { foreach(line; File("myTextFile.txt").byLine()) { writefln(line); } } -- Robert http://octarineparr

Re: Read text file, line by line?

2011-12-13 Thread Iain S
How would one achieve this in D2? I have tried for a couple of hours now and have achieved nothing but stress.