How to use Registry Windows ?

2015-08-29 Thread medhi558 via Digitalmars-d-learn
Hello, I can't seem to use Registry, I tried to many attraction ways but I have every time an error Value cannot be set. Exemple code : module main; import std.stdio; import std.windows.registry; void main(string[] args) { version(Windows) { Key registryKey

Re: How to use Registry Windows ?

2015-08-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/08/15 9:14 PM, medhi558 wrote: Hello, I can't seem to use Registry, I tried to many attraction ways but I have every time an error Value cannot be set. Exemple code : module main; import std.stdio; import std.windows.registry; void main(string[] args) { version(Windows) {

Re: How to use Registry Windows ?

2015-08-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 29 August 2015 at 09:35:47 UTC, medhi558 wrote: It doesn't always work the same error. Is your program running with administrator rights? Unprivileged programs may not write to HKEY_LOCAL_MACHINE by default.

How to use Registry Windows ?

2015-08-29 Thread medhi558 via Digitalmars-d-learn
It doesn't always work the same error.

Re: How to use Registry Windows ?

2015-08-29 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 29 August 2015 at 09:44:06 UTC, medhi558 wrote: I just tried with administrator rights, but it doesn't work. You need to use a REGSAM value (e.g. KEY_ALL_ACCESS) to open the key with write access: /// test.d /// import std.windows.registry; void

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread drug via Digitalmars-d-learn
29.08.2015 15:56, cym13 пишет: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier ulong pointsNumber;

Re: How to use Registry Windows ?

2015-08-29 Thread medhi558 via Digitalmars-d-learn
Thank you it works.

What is the D way to map a binary file to a structure?

2015-08-29 Thread cym13 via Digitalmars-d-learn
Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier ulong pointsNumber; Point[] points; // Array of

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread cym13 via Digitalmars-d-learn
On Saturday, 29 August 2015 at 13:56:10 UTC, drug wrote: Try, for example, MessagePack https://github.com/msgpack/msgpack-d.git Thanks, but it isn't answering the question at all. I'm not looking for a serialization method, I'm looking for the best way to read a binary file.

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread cym13 via Digitalmars-d-learn
On Saturday, 29 August 2015 at 14:52:51 UTC, drug wrote: 29.08.2015 17:17, cym13 пишет: On Saturday, 29 August 2015 at 13:56:10 UTC, drug wrote: Try, for example, MessagePack https://github.com/msgpack/msgpack-d.git Thanks, but it isn't answering the question at all. I'm not looking for a

Re: Class info on interfaces

2015-08-29 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-28 22:40, rumbu wrote: The linkage check it's good as long you don't have an abomination like this: extern(C++) interface CPPInterface { extern(D) void foo(); } Good point. Anyway, the problem is the availability of such function. If the interface doesn't contain any

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread drug via Digitalmars-d-learn
29.08.2015 17:17, cym13 пишет: On Saturday, 29 August 2015 at 13:56:10 UTC, drug wrote: Try, for example, MessagePack https://github.com/msgpack/msgpack-d.git Thanks, but it isn't answering the question at all. I'm not looking for a serialization method, I'm looking for the best way to read a

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread cym13 via Digitalmars-d-learn
On Saturday, 29 August 2015 at 16:47:23 UTC, Laeeth Isharc wrote: Align(1) ? That should do it, thanks :)

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread drug via Digitalmars-d-learn
29.08.2015 18:05, cym13 пишет: On Saturday, 29 August 2015 at 14:52:51 UTC, drug wrote: 29.08.2015 17:17, cym13 пишет: On Saturday, 29 August 2015 at 13:56:10 UTC, drug wrote: Try, for example, MessagePack https://github.com/msgpack/msgpack-d.git Thanks, but it isn't answering the question

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier

Re: linking external libs

2015-08-29 Thread qznc via Digitalmars-d-learn
On Thursday, 2 July 2015 at 12:10:52 UTC, Nicholas Wilson wrote: Also is there a binding to GMP somewhere? I just hacked one together. I could need the bindings to fix the pidigits benchmark. There is this 7y old code on dsource: http://www.dsource.org/projects/bindings/browser/trunk/gmp

Re: Reading and converting binary file 2 bits at a time

2015-08-29 Thread Mike James via Digitalmars-d-learn
On Saturday, 29 August 2015 at 20:15:53 UTC, Marc Schütz wrote: Just cast to `Crumbs[]` directly: import std.bitmanip; import std.stdio; import std.file; struct Crumbs { mixin(bitfields!( ubyte, one, 2, ubyte, two, 2, ubyte,

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread Suliman via Digitalmars-d-learn
On Saturday, 29 August 2015 at 16:55:44 UTC, cym13 wrote: On Saturday, 29 August 2015 at 16:47:23 UTC, Laeeth Isharc wrote: Align(1) ? That should do it, thanks :) Do not forget to post code example, please, it's interesting to look at your solution...

Re: Reading and converting binary file 2 bits at a time

2015-08-29 Thread via Digitalmars-d-learn
Just cast to `Crumbs[]` directly: import std.bitmanip; import std.stdio; import std.file; struct Crumbs { mixin(bitfields!( ubyte, one, 2, ubyte, two, 2, ubyte, three, 2, ubyte, four, 2 )); } void

Re: observation: D getting a bit complex

2015-08-29 Thread Sergey Korshunoff via Digitalmars-d-learn
Hi! I completely agree. D1 is much better :-) I removed a threading support from my variant because program don't start if OS don't have a POSIX threading (LInux 2.4.37 for example). A garbage colllector can be disabled (as I understand). May be a compiler support (warnings) is needed if gc will

observation: D getting a bit complex

2015-08-29 Thread Spacen Jasset via Digitalmars-d-learn
The following reminds me of the good old C++ template errors the C++ compiler spits out. Whilst D has fixed that problem, some things have gotten more complex. I just wanted to find a replacement for D1 path join, and found this, but it doesn't seem very easy to wade though this stuff.

Re: Reading and converting binary file 2 bits at a time

2015-08-29 Thread Gary Willoughby via Digitalmars-d-learn
On Saturday, 29 August 2015 at 21:50:12 UTC, Mike James wrote: On Saturday, 29 August 2015 at 20:15:53 UTC, Marc Schütz wrote: Just cast to `Crumbs[]` directly: import std.bitmanip; import std.stdio; import std.file; struct Crumbs { mixin(bitfields!( ubyte,

Re: Reading and converting binary file 2 bits at a time

2015-08-29 Thread anonymous via Digitalmars-d-learn
On Saturday, 29 August 2015 at 23:34:47 UTC, Gary Willoughby wrote: But it might not be safe: http://forum.dlang.org/thread/ztefzijqhwrouzlag...@forum.dlang.org That link just takes me to this thread here again.