Re: Setting default values for Main function's args Array

2019-06-27 Thread Vaidas via Digitalmars-d-learn
On Thursday, 27 June 2019 at 17:22:36 UTC, Paul Backus wrote: On Thursday, 27 June 2019 at 17:20:37 UTC, Paul Backus wrote: void main(string[] args) { string[] defaultArgs = ["my", "default", "arguments"]; if (args.length == 0) { args = defaultArgs; } // Process args...

Re: dll

2019-06-27 Thread DanielG via Digitalmars-d-learn
For somebody who isn't familiar - what's the issue exactly?

Re: Reading formatted file

2019-06-27 Thread a11e99z via Digitalmars-d-learn
On Thursday, 27 June 2019 at 13:31:23 UTC, Tabamon wrote: I am new at D, I'm making a sudoku solver in D, I wanted to add the option to read sudoku from a .txt file. 1) try to google "dlang read text file", most probably 1,2,3 link will help to u. 2)

Re: Setting default values for Main function's args Array

2019-06-27 Thread wjoe via Digitalmars-d-learn
On Thursday, 27 June 2019 at 17:05:05 UTC, Vaidas wrote: Is it possible to set the default values for the Main function's arguments? It seems that I'm getting Range error. import std.stdio : writeln; void main(string[] args = ["asdsfasdf", "asdklfajsdk", "asdfasdfasd"]){ writeln("",

Re: dll

2019-06-27 Thread bauss via Digitalmars-d-learn
On Thursday, 27 June 2019 at 16:56:00 UTC, fred wrote: https://forum.dlang.org/thread/osnema$d5s$1...@digitalmars.com dll support is it ok now? i cant find the docs on thatm Not much better.

Re: Setting default values for Main function's args Array

2019-06-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 27 June 2019 at 17:05:05 UTC, Vaidas wrote: Is it possible to set the default values for the Main function's arguments? No, as far as the language is concerned, a value is always being passed from the operating system, so those default values would never trigger. What you

Re: Reading formatted file

2019-06-27 Thread a11e99z via Digitalmars-d-learn
On Thursday, 27 June 2019 at 13:52:43 UTC, a11e99z wrote: On Thursday, 27 June 2019 at 13:31:23 UTC, Tabamon wrote: 1) try to google "dlang read text file", most probably 1,2,3 link will help to u. 2) https://dlang.org/library/std/file/read_text.html string content = readText( fileName );

Re: question about call cpp class constructer without new , and define cpp delegate

2019-06-27 Thread Rémy Mouëza via Digitalmars-d-learn
On Thursday, 27 June 2019 at 05:57:49 UTC, evilrat wrote: On Thursday, 27 June 2019 at 05:37:08 UTC, ChangLoong wrote: If I want call cpp class constructer without new method, is there a way to do that ? If what you really want is to actually allocate using C++ new operator from D, then that

dll

2019-06-27 Thread fred via Digitalmars-d-learn
https://forum.dlang.org/thread/osnema$d5s$1...@digitalmars.com dll support is it ok now? i cant find the docs on thatm

Re: Setting default values for Main function's args Array

2019-06-27 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 27 June 2019 at 17:20:37 UTC, Paul Backus wrote: void main(string[] args) { string[] defaultArgs = ["my", "default", "arguments"]; if (args.length == 0) { args = defaultArgs; } // Process args... } Correction: you should check for `args.length == 1`, since

Re: Setting default values for Main function's args Array

2019-06-27 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 27 June 2019 at 17:05:05 UTC, Vaidas wrote: Is it possible to set the default values for the Main function's arguments? It seems that I'm getting Range error. import std.stdio : writeln; void main(string[] args = ["asdsfasdf", "asdklfajsdk", "asdfasdfasd"]){ writeln("",

Reading formatted file

2019-06-27 Thread Tabamon via Digitalmars-d-learn
Hello World! I am new at D, I'm making a sudoku solver in D, I wanted to add the option to read sudoku from a .txt file. I am finding a bit confusing how to open, read and close files in D. I am trying to mimic the C code: FILE *f_in; f_in=fopen("sudoku.txt"); if (f_in==NULL){ exit(1); }

Setting default values for Main function's args Array

2019-06-27 Thread Vaidas via Digitalmars-d-learn
Is it possible to set the default values for the Main function's arguments? It seems that I'm getting Range error. import std.stdio : writeln; void main(string[] args = ["asdsfasdf", "asdklfajsdk", "asdfasdfasd"]){ writeln("", args[1]); } Output:

Re: question about call cpp class constructer without new , and define cpp delegate

2019-06-27 Thread evilrat via Digitalmars-d-learn
On Thursday, 27 June 2019 at 17:00:01 UTC, Rémy Mouëza wrote: I though support for C++ allocation had improved. In a recent release, there was the addition of core.stdcpp.new, but I didn't try it out: - http://dpldocs.info/experimental-docs/core.stdcpp.new_.html -

Re: Illegal Filename after basic install and trying Hello World

2019-06-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 26, 2019 8:39:09 AM MDT Nicholas Wilson via Digitalmars- d-learn wrote: > On Wednesday, 26 June 2019 at 13:57:22 UTC, Gilbert Fernandes > > None do help. The option "override linker settings from sc.ini" > > it may be called dmd.conf (it is on my Mac, but the windows may > be

Re: question about call cpp class constructer without new , and define cpp delegate

2019-06-27 Thread evilrat via Digitalmars-d-learn
On Thursday, 27 June 2019 at 05:37:08 UTC, ChangLoong wrote: If I want call cpp class constructer without new method, is there a way to do that ? If what you really want is to actually allocate using C++ new operator from D, then that is very problematic and not portable even across