This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37548] printf does not process correctly the (bounded) conversion specification of strings
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Sep 2008 01:00:01 -0000
- Subject: [Bug c/37548] printf does not process correctly the (bounded) conversion specification of strings
- References: <bug-37548-16724@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-09-17 01:00 -------
The field width is not taken into account if there is more than that width.
You also need to specify the precision.
printf("\n the 4 leftmost characters of xyz are: \"%.4s\"\n\n",xyz);
Will work. Note the "." there.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37548