bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

printf oddity (coreutils 5.0)


From: Reuben Thomas
Subject: printf oddity (coreutils 5.0)
Date: Mon, 16 Feb 2004 16:17:27 +0100 (CET)

I'm not sure if this is a bug, but

printf "%c" 49

prints

4

instead of what I'd expect, which is

1

(ASCII 49)

Taken literally, I suppose this could be construed as "converting the
argument to the correct type", since the argument 49 is really a string,
but is seems a bit perverse, and it's certainly not what a C programmer
(like me!) would expect by analogy with

printf("%c", 49);

This happens with /usr/bin/printf, and also with bash printf on a number
of systems which made me wonder whether I'm just being stupid...

-- 
http://www.mupsych.org/~rrt/ | God is the name of our ignorance (Grayling)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]