Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 01, 2005 unformatted output | ||||
---|---|---|---|---|
| ||||
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? |
September 01, 2005 Re: unformatted output | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hasan Aljudy | 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 |
September 01, 2005 Re: unformatted output | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | 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!
|
September 01, 2005 Re: unformatted output | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hasan Aljudy | 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
|
Copyright © 1999-2021 by the D Language Foundation