On Sunday, 15 May 2022 at 12:19:22 UTC, SvGaming wrote:
[...]
This code runs as expected.

Strange. It does not for me. I even tried different compilers.
It simply does not ask for user input here where it is supposed to:
```d
writef("Type the path to your USB drive: ");
string cont = readln;
writeln(cont); // there was no variable named "a"
```

Install the `strace` program (I assume you are running Linux) and start your program under strace:

```
   $ strace -f <name of the executable>
```

Then examine the system calls. On my machine I get this:

```
[...]
mmap(NULL, 4194304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffff6beb000
read(4, "", 4096)                       = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
read(4, "", 4096)                       = 0
wait4(26713, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 26713
close(4)                                = 0
munmap(0x7ffff7ff5000, 4096)            = 0
write(1, "\n", 1
)                       = 1
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 10), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffff7ff5000 write(1, "Type the path to your USB drive:"..., 33Type the path to your USB drive: ) = 33
read(0,
```

Here the program waits for input.

Reply via email to