Re: struct File. property size.

2017-05-11 Thread AntonSotov via Digitalmars-d-learn
On Thursday, 11 May 2017 at 08:42:26 UTC, Nicholas Wilson wrote: Are you in windows perchance? IIRC the when compiling for 32 bit it doesn't use the 64 bit C file function so that will not work. Yes, windows. Ok, I understood you.

struct File. property size.

2017-05-11 Thread AntonSotov via Digitalmars-d-learn
import std.stdio; int main() { auto big = File("bigfile", "r+"); //bigfile size 20 GB writeln(big.size); // ERROR! return 0; } // std.exception.ErrnoException@std\stdio.d(1029): Could not seek in file `bigfile` (Invalid argument) I can not work

Re: null as parametr

2016-07-30 Thread AntonSotov via Digitalmars-d-learn
2 Seb Thank you! is (T: typeof (null)) - very comfortable

null as parametr

2016-07-30 Thread AntonSotov via Digitalmars-d-learn
import std.stdio; void myFunc(T)(in T val) { static if(is(T == string)) { writeln("string: ", val); } static if(is(T : long)) { writeln("long: ", val); } static if // WHAT HERE ? writeln("null"); } } int main(string[] args)

Re: RedBlackTree and myClass

2016-01-03 Thread AntonSotov via Digitalmars-d-learn
tsbockman, Many thanks! Now I work for me

RedBlackTree and myClass

2016-01-03 Thread AntonSotov via Digitalmars-d-learn
import std.container.rbtree; class myClass { string str; } int main() { auto tree = new RedBlackTree!myClass; return 0; } Error: mutable method object.Object.opCmp is not callable using a inout object Error: template instance std.functional.binaryFun!("a < b", "a", "b").binaryFu

curl and proxy

2014-10-02 Thread AntonSotov via Digitalmars-d-learn
auto http = HTTP("dlang.org"); http.onReceive = (ubyte[] data) { writeln(cast(string) (data)); return data.length; }; http.proxy = "192.168.111.111"; http.proxyPort = 1788; WHAT HERE ? http.perform(); // how to make Сurl authorize on a pr

Re: std.zip and a large archive

2014-07-19 Thread AntonSotov via Digitalmars-d-learn
On Saturday, 19 July 2014 at 10:46:31 UTC, Marc Schütz wrote: Hmm... it's unfortunate that ZipArchive doesn't take a file descriptor. As a workaround, you can use memory mapping: auto mmfile = new MmFile("c:/test.zip"); Thank you. it works!

std.zip and a large archive

2014-07-19 Thread AntonSotov via Digitalmars-d-learn
I process archive: /// import std.stdio, std.zip, std.file; int main() { auto zip = new ZipArchive(read("c:/test.zip")); foreach (item; zip.directory) { writeln("processing ", item.name, " ..."); // processing item... } return 0; } / it works well for n

Re: Create const regex?

2014-06-06 Thread AntonSotov via Digitalmars-d-learn
On Friday, 6 June 2014 at 12:08:40 UTC, Rikki Cattermole wrote: In none of your examples you have not defined the type of the variables. However you are giving it an access modifier. I assume you are wanting auto. no. keyword "const auto" before the variable name - equivalently "const".

Create const regex?

2014-06-06 Thread AntonSotov via Digitalmars-d-learn
const r1 = regex("bla"); matchFirst( "big string", r1 ); // ERROR! immutable r2 = regex("bla"); // ERROR! Why can I not use const/immutable regex?