Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 07, 2013 How to send a command to the system? | ||||
---|---|---|---|---|
| ||||
I want to send a pause command to the system like in C++: system("pause"); Or like in Ruby: `pause` Something like that. I searched the library, but I haven't found it. I tough that it might be std.system, but it was only to check the OS at runtime. |
August 07, 2013 Re: How to send a command to the system? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Borislav Kosharov | On Wednesday, 7 August 2013 at 15:12:09 UTC, Borislav Kosharov wrote: > I want to send a pause command to the system like in C++: system("pause"); > Or like in Ruby: `pause` > > Something like that. I searched the library, but I haven't found it. I tough that it might be std.system, but it was only to check the OS at runtime. http://dlang.org/phobos/std_process.html#.execute ? |
August 07, 2013 Re: How to send a command to the system? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Wednesday, 7 August 2013 at 15:21:43 UTC, Dicebot wrote:
> On Wednesday, 7 August 2013 at 15:12:09 UTC, Borislav Kosharov wrote:
>> I want to send a pause command to the system like in C++: system("pause");
>> Or like in Ruby: `pause`
>>
>> Something like that. I searched the library, but I haven't found it. I tough that it might be std.system, but it was only to check the OS at runtime.
>
> http://dlang.org/phobos/std_process.html#.execute ?
Oh nice, thanks. I see that process has many useful functons.
|
August 07, 2013 Re: How to send a command to the system? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Borislav Kosharov | On 08/07/2013 08:12 AM, Borislav Kosharov wrote:
> I want to send a pause command to the system like in C++: system("pause");
> Or like in Ruby: `pause`
>
> Something like that. I searched the library, but I haven't found it. I
> tough that it might be std.system, but it was only to check the OS at
> runtime.
If you want to pause the current thread, there is Thread.sleep:
import std.stdio;
import core.thread;
void main()
{
writeln("Good night.");
Thread.sleep(3.seconds);
writeln("Good morning.");
}
Ali
|
August 09, 2013 Re: How to send a command to the system? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Wednesday, 7 August 2013 at 22:06:16 UTC, Ali Çehreli wrote:
> On 08/07/2013 08:12 AM, Borislav Kosharov wrote:
>> I want to send a pause command to the system like in C++: system("pause");
>> Or like in Ruby: `pause`
>>
>> Something like that. I searched the library, but I haven't found it. I
>> tough that it might be std.system, but it was only to check the OS at
>> runtime.
>
> If you want to pause the current thread, there is Thread.sleep:
>
> import std.stdio;
> import core.thread;
>
> void main()
> {
> writeln("Good night.");
> Thread.sleep(3.seconds);
> writeln("Good morning.");
> }
>
> Ali
No, I meant a different pause. It is the one that you send to the OS and it says:
Press any key to continue...
But thanks for showing me the sleep function.
|
Copyright © 1999-2021 by the D Language Foundation