digitalmars.D.learn - Using writefln with format specifiers in string
- Kramer (16/16) Feb 13 2006 I'm hoping someone has run across this before...
- Derek Parnell (6/7) Feb 13 2006 writefln("%s", FileName);
- Kramer (4/11) Feb 14 2006 Ugg, thanks Derek. Reading the docs help, but reading them carefully he...
- Hasan Aljudy (8/31) Feb 15 2006 I ran into this before :)
- Chris Miller (4/32) Feb 15 2006 Yep, and writeln, but you could just use dout.writeString() /
- David Medlock (3/43) Feb 15 2006 Perhaps the formatting should allow '%%' to represent a single percent s...
- Jarrett Billingsley (5/7) Feb 15 2006 It does. writefln("5%%") outputs "5%." The problem is that he wants to...
- Derek Parnell (9/40) Feb 15 2006 You could always just write such a function and send it to Walter. It mi...
- Bruno Medeiros (7/41) Feb 16 2006 Yup, I think we should have one such function (write and writeln) in the...
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (7/12) Feb 18 2006 I wrote write, writeln, read, readln but there was no response.
I'm hoping someone has run across this before... I was listing some files in a directory using listdir and then printing out the names using writefln, but the program kept terminating before finishing printing all the contents. I finally figured out it was because in one of the filenames there was a percent sign. So, running the following program on DMD 0.146 will produce a FormatError: How can I get around this? I'm running Windows XP SP2 and I tried the command chcp 65001 to set my console to UTF-8 thinking that might be it, but no go. Then I piped this to a file and lo and behold, the output stopped in the file at the same point on the console. Any help on this would be much appreciated? -Kramer
Feb 13 2006
On Tue, 14 Feb 2006 18:00:37 +1100, Kramer <Kramer_member pathlink.com> wrote:How can I get around this?writefln("%s", FileName); -- Derek Parnell Melbourne, Australia
Feb 13 2006
In article <op.s4yb3wev6b8z09 ginger.vic.bigpond.net.au>, Derek Parnell says...On Tue, 14 Feb 2006 18:00:37 +1100, Kramer <Kramer_member pathlink.com> wrote:Ugg, thanks Derek. Reading the docs help, but reading them carefully helps more. <g> -KramerHow can I get around this?writefln("%s", FileName); -- Derek Parnell Melbourne, Australia
Feb 14 2006
Kramer wrote:In article <op.s4yb3wev6b8z09 ginger.vic.bigpond.net.au>, Derek Parnell says...I ran into this before :) I think there really should be a _standard_ writeraw() or just write() (with no f) which does exactly that .. void writer( char[] x ) { writef("%s", x); }On Tue, 14 Feb 2006 18:00:37 +1100, Kramer <Kramer_member pathlink.com> wrote:Ugg, thanks Derek. Reading the docs help, but reading them carefully helps more. <g> -KramerHow can I get around this?writefln("%s", FileName); -- Derek Parnell Melbourne, Australia
Feb 15 2006
On Wed, 15 Feb 2006 09:59:48 -0500, Hasan Aljudy <hasan.aljudy gmail.com> wrote:Kramer wrote:Yep, and writeln, but you could just use dout.writeString() / dout.writeLine().In article <op.s4yb3wev6b8z09 ginger.vic.bigpond.net.au>, Derek Parnell says...I ran into this before :) I think there really should be a _standard_ writeraw() or just write() (with no f) which does exactly that .. void writer( char[] x ) { writef("%s", x); }On Tue, 14 Feb 2006 18:00:37 +1100, Kramer <Kramer_member pathlink.com> wrote:Ugg, thanks Derek. Reading the docs help, but reading them carefully helps more. <g> -KramerHow can I get around this?writefln("%s", FileName); -- Derek Parnell Melbourne, Australia
Feb 15 2006
Chris Miller wrote:On Wed, 15 Feb 2006 09:59:48 -0500, Hasan Aljudy <hasan.aljudy gmail.com> wrote:Perhaps the formatting should allow '%%' to represent a single percent sign? -DavidMKramer wrote:Yep, and writeln, but you could just use dout.writeString() / dout.writeLine().In article <op.s4yb3wev6b8z09 ginger.vic.bigpond.net.au>, Derek Parnell says...I ran into this before :) I think there really should be a _standard_ writeraw() or just write() (with no f) which does exactly that .. void writer( char[] x ) { writef("%s", x); }On Tue, 14 Feb 2006 18:00:37 +1100, Kramer <Kramer_member pathlink.com> wrote:Ugg, thanks Derek. Reading the docs help, but reading them carefully helps more. <g> -KramerHow can I get around this?writefln("%s", FileName); -- Derek Parnell Melbourne, Australia
Feb 15 2006
"David Medlock" <noone nowhere.com> wrote in message news:dsvouc$1fl5$1 digitaldaemon.com...Perhaps the formatting should allow '%%' to represent a single percent sign?It does. writefln("5%%") outputs "5%." The problem is that he wants to print out arbitrary strings which may have single percent signs, and he doesn't want format() interpreting the percent signs as format specifiers.
Feb 15 2006
On Wed, 15 Feb 2006 07:59:48 -0700, Hasan Aljudy wrote:Kramer wrote:You could always just write such a function and send it to Walter. It might even make it to the official library. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 16/02/2006 10:12:47 AMIn article <op.s4yb3wev6b8z09 ginger.vic.bigpond.net.au>, Derek Parnell says...I ran into this before :) I think there really should be a _standard_ writeraw() or just write() (with no f) which does exactly that .. void writer( char[] x ) { writef("%s", x); }On Tue, 14 Feb 2006 18:00:37 +1100, Kramer <Kramer_member pathlink.com> wrote:Ugg, thanks Derek. Reading the docs help, but reading them carefully helps more. <g> -KramerHow can I get around this?writefln("%s", FileName); -- Derek Parnell Melbourne, Australia
Feb 15 2006
Derek Parnell wrote:On Wed, 15 Feb 2006 07:59:48 -0700, Hasan Aljudy wrote:Yup, I think we should have one such function (write and writeln) in the stdlib. -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural."Kramer wrote:You could always just write such a function and send it to Walter. It might even make it to the official library.In article <op.s4yb3wev6b8z09 ginger.vic.bigpond.net.au>, Derek Parnell says...I ran into this before :) I think there really should be a _standard_ writeraw() or just write() (with no f) which does exactly that .. void writer( char[] x ) { writef("%s", x); }On Tue, 14 Feb 2006 18:00:37 +1100, Kramer <Kramer_member pathlink.com> wrote:Ugg, thanks Derek. Reading the docs help, but reading them carefully helps more. <g> -KramerHow can I get around this?writefln("%s", FileName); -- Derek Parnell Melbourne, Australia
Feb 16 2006
Derek Parnell wrote:I wrote write, writeln, read, readln but there was no response. (i.e. they didn't make into std.stdio, but to din/dout instead) Will try again. Some day. --anders PS. http://www.digitalmars.com/d/archives/digitalmars/D/15627.htmlI think there really should be a _standard_ writeraw() or just write() (with no f) which does exactly that ..You could always just write such a function and send it to Walter. It might even make it to the official library.
Feb 18 2006