Error: conversion, reading from file
bearophile
bearophileHUGS at lycos.com
Sun Jul 19 10:38:10 PDT 2009
Michael P.:
> The output I get is:
> 440
> Error: conversion
>
> The high scores that are printed above is what is in the file.
> I am using DMD1.046 with Phobos.
Try:
import std.string: strip;
...
highScoreList ~= toInt(strip(file[0 .. nextScore]));
I have never understand the rationale of not ignoring whitespace inside the toInt, I think it's an ugly design.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list