With the char[], I can't use spaces in it the way I've got it here, (like if I tried using a phrase):

void saveLevel( string fileName ) {
        int ver = 1;
        auto house = "two".dup;
        double rnum = 3.0;
        
        {
                auto fout = File( fileName, "wb"); // open for binary writing
                scope( exit )
                        fout.close;
                fout.writef( "%d %s %f", ver, house, rnum );
        }
        
        ver = 593;
        house = "asdfghf".dup;
        rnum = 57.23;

        {
                auto fin = File( fileName, "rb"); // open for binary reading
                scope( exit )
                        fin.close;
                fin.readf( "%d %s %f", &ver, &house, &rnum );
        }

        writeln( "\nint: ", ver, " string: '", house, "' rnum: ", rnum );
}

- Joel

Reply via email to