On Thursday, 31 December 2020 at 18:19:54 UTC, Ali Çehreli wrote:
Can you describe it with a piece of code? If the code shows what the current undesired output is and what you want instead, perhaps we can find a solution.

Regarding the enum part;
While trying to do this I noticed one cannot use either slurp or formattedRead to read enums, while it is possible to use formattedWrite and write to write them. Strangely enough this was also mentioned in old issue '18051' (https://forum.dlang.org/thread/mailman.735.1512835762.9493.digitalmars-d-b...@puremagic.com) which should have been resolved.

Example code;
```
import std.stdio;
import std.file : slurp;
import std.format;
import std.typecons;

enum Thing {
        A,
        B
}

void main() {
        File file = File("temp.txt", "r");
        foreach (line; file.byLine) {
                int integer;
                Thing thing;
formattedRead!"%s %s"(line, integer, thing); // crashes with thing as Thing, works with thing as char. formattedWrite(stdout.lockingTextWriter, "%s %s\n", integer, thing);
        }
}
```

Reply via email to