I am trying to create simple app that would read user input and open file with such name, but every time when I run it's crash with error

"std.file.FileException@std\file.d(294): \1.txt"

import std.stdio;
import std.string;
import std.file;

void main()
{
        string getfilename()
        {
        auto name = readln();
        writeln(name);
        if (exists(name))
                {
                        writeln("exist");
                }
        else
                writeln("not exist");
        
        return name;
        }

        void readfile(string name)
        {
        auto filearray = read(name);
        writeln(name);
        writeln(filearray);
        }
        readfile(getfilename());


}

Reply via email to