www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - unformatted output

reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
I'm reading a .d file, and for debugging purposes I need to output the 
content of that file (or some of it) to the screen in certain ways.

What I usually do is read the part I want to output in an array then 
write that array
#writefln( text );

The problem is, the text itself could be something like:
printf("%d stuff", stuff);
in which case I would be outputting a string that contains a "%d", thus 
the writefln function would expect me to supply an integer, which I 
obviously didn't do, and I get an std.formatter error and the program 
aborts.

Can I do unformatted output? or is there a work around?
Aug 31 2005
parent reply Derek Parnell <derek psych.ward> writes:
On Wed, 31 Aug 2005 23:41:43 -0600, Hasan Aljudy wrote:

 I'm reading a .d file, and for debugging purposes I need to output the 
 content of that file (or some of it) to the screen in certain ways.
 
 What I usually do is read the part I want to output in an array then 
 write that array
 #writefln( text );
 
 The problem is, the text itself could be something like:
 printf("%d stuff", stuff);
 in which case I would be outputting a string that contains a "%d", thus 
 the writefln function would expect me to supply an integer, which I 
 obviously didn't do, and I get an std.formatter error and the program 
 aborts.
 
 Can I do unformatted output? or is there a work around?
writefln("%s", text); -- Derek (skype: derek.j.parnell) Melbourne, Australia 1/09/2005 4:24:38 PM
Aug 31 2005
parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Derek Parnell wrote:
 On Wed, 31 Aug 2005 23:41:43 -0600, Hasan Aljudy wrote:
 
 
I'm reading a .d file, and for debugging purposes I need to output the 
content of that file (or some of it) to the screen in certain ways.

What I usually do is read the part I want to output in an array then 
write that array
#writefln( text );

The problem is, the text itself could be something like:
printf("%d stuff", stuff);
in which case I would be outputting a string that contains a "%d", thus 
the writefln function would expect me to supply an integer, which I 
obviously didn't do, and I get an std.formatter error and the program 
aborts.

Can I do unformatted output? or is there a work around?
writefln("%s", text);
Thanks! lol, how simple! I must be dumb!
Sep 01 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Hasan Aljudy wrote:

 Can I do unformatted output? or is there a work around?
writefln("%s", text);
Thanks! lol, how simple! I must be dumb!
Not really, there _should_ be an "unformatted" variant too... I suggested: writeln(text); --anders
Sep 01 2005