Re: How to simulate Window's "Press any key to continue..."

2019-11-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:45:21 UTC, Mike Parker wrote: On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific

Re: How to simulate Window's "Press any key to continue..."

2019-11-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific key The documentation for std.stdio.File shows two functions

Re: How to simulate Window's "Press any key to continue..."

2019-11-21 Thread mipri via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:41:30 UTC, mipri wrote: ~this() { reset(); } Oh, if you don't ever call raw() this will break your terminal. I just copied some code from a toy program and adapted it, and didn't notice that until I posted.

Re: How to simulate Window's "Press any key to continue..."

2019-11-21 Thread mipri via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific key If curses is available you can use it, at the cost of

Re: How to simulate Window's "Press any key to continue..."

2019-11-21 Thread FireController#1847 via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:19:40 UTC, mipri wrote: On Friday, 22 November 2019 at 04:10:23 UTC, FireController#1847 wrote: I'm an extreme beginner to DLang (just started using it.. oh, an hour ago?), and I already can't figure out a, what I'd consider, fairly simplistic thing. This is

Re: How to simulate Window's "Press any key to continue..."

2019-11-21 Thread mipri via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:10:23 UTC, FireController#1847 wrote: I'm an extreme beginner to DLang (just started using it.. oh, an hour ago?), and I already can't figure out a, what I'd consider, fairly simplistic thing. This is my current code: module DTestApp1; import std.stdio;

How to simulate Window's "Press any key to continue..."

2019-11-21 Thread FireController#1847 via Digitalmars-d-learn
I'm an extreme beginner to DLang (just started using it.. oh, an hour ago?), and I already can't figure out a, what I'd consider, fairly simplistic thing. This is my current code: module DTestApp1; import std.stdio; int main() { write("Press any key to continue..."); stdin.read();

Re: The effect of ref

2019-11-21 Thread ketmar via Digitalmars-d-learn
Adam D. Ruppe wrote: On Friday, 22 November 2019 at 03:42:26 UTC, dokutoku wrote: Is there a difference in the execution speed and stability when executing the program by rewriting the parameter of the function argument like this? the generated code the processor sees is generally

Re: The effect of ref

2019-11-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 22 November 2019 at 03:42:26 UTC, dokutoku wrote: Is there a difference in the execution speed and stability when executing the program by rewriting the parameter of the function argument like this? the generated code the processor sees is generally identical, but the `ref`

Re: The effect of ref

2019-11-21 Thread mipri via Digitalmars-d-learn
On Friday, 22 November 2019 at 03:42:26 UTC, dokutoku wrote: Is there a difference in the execution speed and stability when executing the program by rewriting the parameter of the function argument like this? ```d void test1 (int * X) { // some processing } void test2 (ref int X) {

The effect of ref

2019-11-21 Thread dokutoku via Digitalmars-d-learn
Is there a difference in the execution speed and stability when executing the program by rewriting the parameter of the function argument like this? ```d void test1 (int * X) { // some processing } void test2 (ref int X) { // some processing } ```

Re: Splitting a stream of data on based on data change.

2019-11-21 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Thursday, 21 November 2019 at 22:11:59 UTC, Alex wrote: On Thursday, 21 November 2019 at 21:36:08 UTC, Taylor R Hillegeist wrote: I was looking through the standard library for a good way to split a range into several ranges based on value changes in the stream: AAABB would be

Re: Splitting a stream of data on based on data change.

2019-11-21 Thread Alex via Digitalmars-d-learn
On Thursday, 21 November 2019 at 21:36:08 UTC, Taylor R Hillegeist wrote: I was looking through the standard library for a good way to split a range into several ranges based on value changes in the stream: AAABB would be split on the AB transition into: AAA BB I just

Splitting a stream of data on based on data change.

2019-11-21 Thread Taylor R Hillegeist via Digitalmars-d-learn
I was looking through the standard library for a good way to split a range into several ranges based on value changes in the stream: AAABB would be split on the AB transition into: AAA BB I just couldn't figure out an elegant way to do it? Any ideas?

Re: equivalent of typeid(Class).name at compile-time

2019-11-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 21 November 2019 at 20:45:16 UTC, Steven Schveighoffer wrote: To clarify, I need the compile time string that will match typeid(instance).name, so I can match the derived type. You have to make sure that the derived type is passed to your register function, but then

Re: equivalent of typeid(Class).name at compile-time

2019-11-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/21/19 3:44 PM, Steven Schveighoffer wrote: I thought I could do typeid(Class).name to get the class name that will be returned at runtime if you did typeid(instance).name. But it's not accessible at compile-time. What compile-time string should I use for instance in a constructed

equivalent of typeid(Class).name at compile-time

2019-11-21 Thread Steven Schveighoffer via Digitalmars-d-learn
I thought I could do typeid(Class).name to get the class name that will be returned at runtime if you did typeid(instance).name. But it's not accessible at compile-time. What compile-time string should I use for instance in a constructed switch statement? I'm trying to implement serialization

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread JN via Digitalmars-d-learn
On Thursday, 21 November 2019 at 09:26:39 UTC, zoujiaqing wrote: On Thursday, 21 November 2019 at 08:42:39 UTC, Seb wrote: Note this line: Running .\myproject.exe Program exited with code -1073741515 Your compiled program is crashing. Could you run the compiled binary manually and obtain

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 21 November 2019 at 08:42:39 UTC, Seb wrote: Note this line: Running .\myproject.exe Program exited with code -1073741515 Your compiled program is crashing. Could you run the compiled binary manually and obtain a stack trace? Install msvcr100.dll for x64 the question is

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 21 November 2019 at 08:42:39 UTC, Seb wrote: Note this line: Running .\myproject.exe Program exited with code -1073741515 Your compiled program is crashing. Could you run the compiled binary manually and obtain a stack trace? x86 is OK, but x64 bad. PS

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 21 November 2019 at 08:42:39 UTC, Seb wrote: On Thursday, 21 November 2019 at 08:30:33 UTC, zoujiaqing wrote: 1. Download dmd.2.088.1.windows.7z 2. Unzip it to D:\Develop\dmd2 3. Add ENV D:\Develop\dmd2\windows\bin to System Path 4. Run `dub --version` and `dmd --version` in

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread Seb via Digitalmars-d-learn
On Thursday, 21 November 2019 at 08:30:33 UTC, zoujiaqing wrote: 1. Download dmd.2.088.1.windows.7z 2. Unzip it to D:\Develop\dmd2 3. Add ENV D:\Develop\dmd2\windows\bin to System Path 4. Run `dub --version` and `dmd --version` in powershell is OK 5. dub ini myproject (no dependency) 6. Run `cd

Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
1. Download dmd.2.088.1.windows.7z 2. Unzip it to D:\Develop\dmd2 3. Add ENV D:\Develop\dmd2\windows\bin to System Path 4. Run `dub --version` and `dmd --version` in powershell is OK 5. dub ini myproject (no dependency) 6. Run `cd myproject` and `dub run` is error... Error Logging infomation:

Re: How to get child class Type and members from parent class?

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
On Wednesday, 20 November 2019 at 22:26:17 UTC, Adam D. Ruppe wrote: On Wednesday, 20 November 2019 at 20:57:56 UTC, Matheus wrote: This is a different way of designing things, do people use this often? This is really only useful sometimes. It is important to notice that if you do class C :