access violation error
Gide Nwawudu
gide at btinternet.com
Wed Sep 17 04:05:52 PDT 2008
On Wed, 13 Aug 2008 17:35:42 -0400, "Steven Schveighoffer"
<schveiguy at yahoo.com> wrote:
>
>Most likely, this is failing because you are using scanf. Stop using it :)
>Use din.readf instead:
>
>import std.cstream;
>
>char[] str;
>din.readf("%s", &str);
>
The code above causes an Access Violaion in D2. The following works.
import std.stdio : writeln;
import std.cstream : din;
int main() {
char[] str;
din.readf(&str);
writeln(str);
return 0;
}
Gide
More information about the Digitalmars-d-learn
mailing list