On Monday, 18 May 2020 at 18:10:06 UTC, BoQsc wrote:
Also, if you want some kind of Fancy ASCII art in your
application
Since I started this thread, I might share some more improvements.
In this Update I managed to get the PID of the current process and
in the future I hope the HelloWorld program process could be
killed,
I'm kind of stuck right now on how.
Right now a complete Command Line command to compile HelloWorld
example with a working Command Line Interface looks like this:
dmd HelloWorld.d whatever.res && start "" "HelloWorld.exe"
whatever.res - look at above posts on how to generate whatever.res
HelloWorld.d
import std.stdio : write, writeln, readln, writefln;
import std.process : executeShell, kill, thisProcessID;
import core.thread.osthread : getpid;
void main() {
executeShell("title HelloWorld");
executeShell("chcp 65001");
writeln("Hello, World!");
writeln("
▄ .▄▄▄▄ .▄▄▌ ▄▄▌ ▄▄▌ ▐ ▄▌ ▄▄▄ ▄▄▌ ·▄▄▄▄
██▪▐█▀▄.▀·██• ██• ▪ ██· █▌▐█▪ ▀▄ █·██• ██▪ ██
██▀▐█▐▀▀▪▄██▪ ██▪ ▄█▀▄ ██▪▐█▐▐▌ ▄█▀▄ ▐▀▀▄ ██▪ ▐█· ▐█▌
██▌▐▀▐█▄▄▌▐█▌▐▌▐█▌▐▌▐█▌.▐▌ ▐█▌██▐█▌▐█▌.▐▌▐█•█▌▐█▌▐▌██. ██
▀▀▀ · ▀▀▀ .▀▀▀ .▀▀▀ ▀█▄▀▪ ▀▀▀▀ ▀▪ ▀█▄▀▪.▀ ▀.▀▀▀ ▀▀▀▀▀•
");
writefln("Current process id: %s", getpid());
writeln("This process id: ", thisProcessID());
string line;
write("Your Input: ");
while ((line = readln()) !is null) {
writeln(line);
write("Your Input: ");
}
}