sprintf problem
From: Billy N. Patton (b-patton_at_ti.com)
Date: 09/30/04
- Next message: Toni Erdmann: "Re: sprintf problem"
- Previous message: kspecial_at_linuxmail.org: "Re: Potential bug ?"
- Next in thread: Toni Erdmann: "Re: sprintf problem"
- Reply: Toni Erdmann: "Re: sprintf problem"
- Reply: thundergnat: "Re: sprintf problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Sep 2004 10:17:36 -0500
My code:
$lcname = 15;
print sprintf("| %-m.ns |\n",$lcname,4,'CELL');
print sprintf("| %m.ns |\n",$lcname,4,'CELL');
print sprintf("| %mns |\n",$lcname,4,'CELL');
print sprintf("| %s |\n",'CELL');
The results:
| %-m.ns |
| %m.ns |
| %mns |
| CELL |
I need the 'CELL' left justified, padded with spaces and using $lcname
space.
The camel book Pg 223 parag 1
The various combinations are fully documented in the manpage for
printf(3), but we'll mention that m is typically the minimum length of a
field (negative for left justified), and n is precision for exponential
formats and the maximum length for other formats. Padding is typically
done with spaces for strings ...
--
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, b-patton@ti.com
- Next message: Toni Erdmann: "Re: sprintf problem"
- Previous message: kspecial_at_linuxmail.org: "Re: Potential bug ?"
- Next in thread: Toni Erdmann: "Re: sprintf problem"
- Reply: Toni Erdmann: "Re: sprintf problem"
- Reply: thundergnat: "Re: sprintf problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|