digitalmars.D.learn - writef: How to output hex byte?
- Nick Sabalausky (5/5) Aug 28 2010 I'm having trouble understanding the docs on this. From what I could tel...
- Nick Sabalausky (11/16) Aug 28 2010 I gotta learn not to simplify my test cases without re-testing them...
- torhu (5/8) Aug 28 2010 On codepad.org (DMD 1.026 last time I checked), this prints this:
- Nick Sabalausky (3/11) Aug 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4775
I'm having trouble understanding the docs on this. From what I could tell, it seemed like both of these should work: writef("%.2X", myByte); writef("%02X", myByte); But both of them just simply print the format string as-is.
Aug 28 2010
"Nick Sabalausky" <a a.a> wrote in message news:i5cnrn$30hv$1 digitalmars.com...I'm having trouble understanding the docs on this. From what I could tell, it seemed like both of these should work: writef("%.2X", myByte); writef("%02X", myByte); But both of them just simply print the format string as-is.I gotta learn not to simplify my test cases without re-testing them... The above examples work fine, but the following don't - what I'm trying to do here is output a percent sign followed by a hex byte (as in URL escape sequences), but these just output "%%02X": ubyte myByte = 0x09; writef("%%%.2X", myByte); writef("%%%02X", myByte); I know I can easily work around that, but I'm wondering if this is a bug or if I've misunderstood how that format syntax is supposed to work.
Aug 28 2010
On 29.08.2010 07:06, Nick Sabalausky wrote:ubyte myByte = 0x09; writef("%%%.2X", myByte); writef("%%%02X", myByte);On codepad.org (DMD 1.026 last time I checked), this prints this: %09%09 So it's probably a bug in the new formatting code. I assume it's supposed to follow the C behavior in this case.
Aug 28 2010
"torhu" <no spam.invalid> wrote in message news:i5cqgo$37l$1 digitalmars.com...On 29.08.2010 07:06, Nick Sabalausky wrote:http://d.puremagic.com/issues/show_bug.cgi?id=4775ubyte myByte = 0x09; writef("%%%.2X", myByte); writef("%%%02X", myByte);On codepad.org (DMD 1.026 last time I checked), this prints this: %09%09 So it's probably a bug in the new formatting code. I assume it's supposed to follow the C behavior in this case.
Aug 31 2010