stream readf keeps producing bus error on DMD 2.046 on OS X 10.5.8

RedZone kilpa1kb at cmich.edu
Thu Jul 8 14:33:45 PDT 2010


Hi,

I've been trying to use readf to read some basic text from a file... I found,
though, that readf kept producing inexplicable bus errors.  I simplified my
code and tried to use readf on just a plain character array.  No change.
Here's the code:

import std.stdio;
//import std.file;
import std.stream;

void main()
{
	string s1;
	int i;
	string s2;
	string s3;

	char[] s0 = "a 5 bc e".dup;
	auto stream = new TArrayStream!(char[])(s0);

	stream.readf("%s %d %s %s ", &s1, &i, &s2, &s3);
	writefln("%s %d %s %s", s1, i, s2, s3);

}


It doesn't matter how I change the input or what I use as the stream, readf
produces this bus error.  Compiling in release mode doesn't help either.  What
am I doing wrong?

I'm using DMD 2.046 on Mac OS X 10.5.8.


More information about the Digitalmars-d-learn mailing list