digitalmars.D.learn - How to write printf(...) like function
- Cris (14/14) Mar 08 2006 Where is what I'm trying to do is to make a print function that out...
- Chris Sauls (4/23) Mar 08 2006 The attached file is my own test and partial rewrite of your function, w...
- Cris (2/8) Mar 09 2006
Where is what I'm trying to do is to make a print function that outputs both to a console and to a file but I have get a std.format runtime error. Any ideas how to do it? void printTo(...) { char[] string; void putc(dchar c) { string ~= c; } std.format.doFormat(&putc, _arguments, _argptr); printf(string ~= "\0"); // std.c.stdio file.printf(string); }
Mar 08 2006
Cris wrote:Where is what I'm trying to do is to make a print function that outputs both to a console and to a file but I have get a std.format runtime error. Any ideas how to do it? void printTo(...) { char[] string; void putc(dchar c) { string ~= c; } std.format.doFormat(&putc, _arguments, _argptr); printf(string ~= "\0"); // std.c.stdio file.printf(string); }The attached file is my own test and partial rewrite of your function, which essentially works. -- Chris Nicholson-Sauls
Mar 08 2006
Thank you for the help! Your code works now. Was the problem the standard C printf?The attached file is my own test and partial rewrite of your function, which essentially works. -- Chris Nicholson-Sauls
Mar 09 2006