On Wed, 29 Jun 2011 19:55:38 +1200, Joel Christensen wrote:

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

There has been a thread very recently about reading strings. Look for the 
thread "readf with strings" (dated 22-Jun-2011 in my reader). Or, if it 
works here:

http://www.digitalmars.com/webnews/newsgroups.php?
art_group=digitalmars.D.learn&article_id=27762

Reading the entire line:

    string s = chomp(readln());

Kai Meyer suggested parsing the string directly:

     string[] buffer;
     int a;
     float b;
     string c;
     buffer = chomp(readln()).split(" ");
     a = to!(int)(buffer[0]);
     b = to!(float)(buffer[1]);
     c = buffer[2..$].join(" ");
     writef("Read in: '%d' '%f' '%s'\n", a, b, c);

> 
> 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;

You are not supposed to need to close the File object yourself. Being a 
struct, its destructor should be called automatically.

Ali

Reply via email to