D binary io functions

2020-08-30 Thread Andy Balba via Digitalmars-d-learn
going nuts trying to figure out which D functions will read/write binary files

Re: Where can I find the DEFINITION of vibe IOMode ??

2020-09-05 Thread Andy Balba via Digitalmars-d-learn
On Saturday, 5 September 2020 at 19:22:17 UTC, drug wrote: 05.09.2020 22:17, Andy Balba пишет: Where do I fine where IOMode is defined..  as in the last line of ... module vibe.core.stream; import vibe.internal.traits : checkInterfaceConformance, validateInterfaceConformance; import

Where can I find the DEFINITION of vibe IOMode ??

2020-09-05 Thread Andy Balba via Digitalmars-d-learn
Where do I fine where IOMode is defined.. as in the last line of ... module vibe.core.stream; import vibe.internal.traits : checkInterfaceConformance, validateInterfaceConformance; import vibe.internal.interfaceproxy; import core.time; import std.algorithm; import std.conv; public import

Re: D binary io functions

2020-08-30 Thread Andy Balba via Digitalmars-d-learn
On Sunday, 30 August 2020 at 10:02:09 UTC, Arjan wrote: On Sunday, 30 August 2020 at 06:00:20 UTC, Andy Balba wrote: going nuts trying to figure out which D functions will read/write binary files see this blog: http://nomad.uk.net/articles/working-with-files-in-the-d-programming-language.html

is using predSwitch the only way to create to create recursive functions in D ?

2020-07-29 Thread Andy Balba via Digitalmars-d-learn
,,

Re: 2-D array initialization

2020-08-01 Thread Andy Balba via Digitalmars-d-learn
On Saturday, 1 August 2020 at 00:08:33 UTC, MoonlightSentinel wrote: On Friday, 31 July 2020 at 23:42:45 UTC, Andy Balba wrote: How does one initialize c in D ? ubyte[3][4] c = [ [5, 5, 5], [15, 15,15], [25, 25,25], [35, 35,35] ]; none of the statements below works c = cast(ubyte) [

Re: generating random numbers

2020-08-10 Thread Andy Balba via Digitalmars-d-learn
On Monday, 10 August 2020 at 15:13:51 UTC, bachmeier wrote: On Monday, 10 August 2020 at 14:20:23 UTC, bachmeier wrote: On Monday, 10 August 2020 at 05:51:07 UTC, Andy Balba wrote: generating random numbers using https://dlang.org/library/std/random/uniform01.html I find the example given in

How does one run a linux system command from a D main() fcn ?

2020-08-04 Thread Andy Balba via Digitalmars-d-learn
i.e. D equivalent to C++ command system("MyExe")

Re: 2-D array initialization

2020-08-02 Thread Andy Balba via Digitalmars-d-learn
On Sunday, 2 August 2020 at 06:37:06 UTC, tastyminerals wrote: You haven't said anything about efficiency because if you care and your arrays are rather big, you better go with https://github.com/libmir/mir-algorithm as mentioned above. It might be a little finicky at the start but this post:

Re: 2-D array initialization

2020-08-01 Thread Andy Balba via Digitalmars-d-learn
On Saturday, 1 August 2020 at 22:00:43 UTC, Ali Çehreli wrote: On 8/1/20 12:57 PM, Andy Balba wrote: > On Saturday, 1 August 2020 at 00:08:33 UTC, MoonlightSentinel wrote: >> On Friday, 31 July 2020 at 23:42:45 UTC, Andy Balba wrote: >>> How does one initialize c in D ? >> >> ubyte[3][4] c = [

Re: arrays in srucs

2020-07-31 Thread Andy Balba via Digitalmars-d-learn
On Friday, 31 July 2020 at 17:26:17 UTC, Paul Backus wrote: On Friday, 31 July 2020 at 17:02:46 UTC, Andy Balba wrote: The above code, compiles and runs ok .. but sometimes I get run runtime errors using the same paradym, which disappear when I substitute (img.p)[i] Any explanation for this

arrays in srucs

2020-07-31 Thread Andy Balba via Digitalmars-d-learn
I frequently use this paradigm for my image processing apps : import std.stdio ; struct S { int a, b; ubyte[] p; } void main() { S img= S(11,22) ; img.p = new ubyte[5]; foreach (i; 0 .. 5) { img.p[i]=cast(ubyte)(10+i) ; printf(" sa %d sb %d : %d\n", img.a, img.b, img.p[i] ); } } The above

Re: generating random numbers

2020-08-13 Thread Andy Balba via Digitalmars-d-learn
On Monday, 10 August 2020 at 15:43:04 UTC, Andy Balba wrote: On Monday, 10 August 2020 at 15:13:51 UTC, bachmeier wrote: On Monday, 10 August 2020 at 14:20:23 UTC, bachmeier wrote: On Monday, 10 August 2020 at 05:51:07 UTC, Andy Balba wrote: generating random numbers using

Re: safety and auto vectorization

2020-08-04 Thread Andy Balba via Digitalmars-d-learn
On Monday, 3 August 2020 at 19:42:51 UTC, Steven Schveighoffer wrote: On 8/3/20 3:22 PM, Bruce Carneal wrote: Thanks Steve (and Chad).  Summary: underspecified, varying behavior across versions, buggy. Steve, what's the best way for me to report this?  Are spec issues lumped in with the

generating random numbers

2020-08-09 Thread Andy Balba via Digitalmars-d-learn
generating random numbers using https://dlang.org/library/std/random/uniform01.html I find the example given in this section totally incomprehensible .. Can any help me answer two simple questions: How to generate a random floating number in range [0,1) ? How to set a seed value, prior to

2-D array initialization

2020-07-31 Thread Andy Balba via Digitalmars-d-learn
ubyte[3][4] c ; How does one initialize c in D ? none of the statements below works c = cast(ubyte) [ [5, 5, 5], [15, 15,15], [25, 25,25], [35, 35,35] ]; c[0] = ubyte[3] [5, 5, 5] ; c[1] = ubyte[3] [15, 15,15] ; c[2] = ubyte[3] [25, 25,25] ; c[3] = ubyte[3] [35, 35,35] ; for (int