Why doesn't this piece of code work?
kdevel
kdevel at vogtner.de
Sun May 15 12:13:14 UTC 2022
On Sunday, 15 May 2022 at 11:10:41 UTC, SvGaming wrote:
> I want to ask the user to select their USB drive by typing the
> mount location. For some reason that does not work and just
> skips over the user input part.
> ```d
> void writeusb() {
> writeln("Here is a list of your mounted drives: ");
> auto mounts = executeShell("cat /proc/mounts | grep media");
> writeln(mounts.output);
> writef("Type the path to your USB drive: ");
> string cont = readln;
> writeln(a);
> writeln("A file selection menu will now appear so you can
> select an ISO to write.");
> auto seliso = executeShell("zenity --file-selection");
> writeln(seliso.output);
> }
> ```
> I am clueless as to what I need to do here? Can anyone help?
```
import std.stdio;
import std.process;
int main ()
{
writeln("Here is a list of your mounted drives: ");
auto mounts = executeShell("cat /proc/mounts | grep media");
writeln(mounts.output);
writef("Type the path to your USB drive: ");
string cont = readln;
writeln(cont); // there was no variable named "a"
writeln("A file selection menu will now appear so you can
select an ISO to write.");
// auto seliso = executeShell("zenity --file-selection");
// writeln(seliso.output);
return 0;
}
```
This code runs as expected.
More information about the Digitalmars-d-learn
mailing list