www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - writef / writefln and stderr

reply DYH <DYH_member pathlink.com> writes:
Consider this small sample:

 import std.stdio;
 
 int main(char[][] args)
 {
 	writefln(stderr, "test");
 	return 0;
 }

will output something like:
 4164D0test


Is that correct behaviour? DMD 0.163
Jul 20 2006
next sibling parent Oskar Linde <oskar.lindeREM OVEgmail.com> writes:
DYH wrote:
 Consider this small sample:
 
 import std.stdio;

 int main(char[][] args)
 {
 	writefln(stderr, "test");
 	return 0;
 }

will output something like:
 4164D0test


Is that correct behaviour?

Yes. writef(ln) prints all of it's arguments to stdout. stdout is a std.c.stdio._iobuf*, i.e. a pointer. What you see is the pointer value being printed. Try fwritef(ln) instead. /Oskar
Jul 20 2006
prev sibling next sibling parent "Derek Parnell" <derek psych.ward> writes:
On Thu, 20 Jul 2006 23:30:26 +1000, DYH <DYH_member pathlink.com> wrote:

 Consider this small sample:

 import std.stdio;

 int main(char[][] args)
 {
 	writefln(stderr, "test");
 	return 0;
 }

will output something like:
 4164D0test


Is that correct behaviour?

Yes. If you want to write to stderr, use this instead... import std.cstream; derr.writefln("test"); -- Derek Parnell Melbourne, Australia
Jul 20 2006
prev sibling parent DYH <DYH_member pathlink.com> writes:
In article <e9o0hi$2inh$1 digitaldaemon.com>, DYH says...
Consider this small sample:

 import std.stdio;
 
 int main(char[][] args)
 {
 	writefln(stderr, "test");
 	return 0;
 }

will output something like:
 4164D0test


Is that correct behaviour? DMD 0.163

Ok guys, thanks for your replays =)
Jul 20 2006