Go to Post THE GAME PIECES ARE BEARS - JohnSchneider [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-03-2005, 06:02
Kashi Chan Kashi Chan is offline
Registered User
no team
 
Join Date: Mar 2005
Location: California
Posts: 17
Kashi Chan is an unknown quantity at this point
the %3d in printf

what does the %3d do exactly? i dont see it displayed anywhere and the actual value isnt displayed till later in the statement
  #2   Spotlight this post!  
Unread 18-03-2005, 06:04
Kashi Chan Kashi Chan is offline
Registered User
no team
 
Join Date: Mar 2005
Location: California
Posts: 17
Kashi Chan is an unknown quantity at this point
Re: the %3d in printf

mm figured out the d means decimal but not sure bout the 3
  #3   Spotlight this post!  
Unread 18-03-2005, 06:32
Kris Verdeyen's Avatar
Kris Verdeyen Kris Verdeyen is offline
LSR Emcee/Alamo Game Announcer
FRC #0118 (Robonauts)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Houston, TX
Posts: 699
Kris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond reputeKris Verdeyen has a reputation beyond repute
Re: the %3d in printf

Quote:
Originally Posted by Kashi Chan
mm figured out the d means decimal but not sure bout the 3
The 3 is the number of displayed digits.

If you use a number there, it will print leading zeros to fill up the number, up to 3. Instead of '1', it will print '001';
__________________
...Only a few people are awake and they live in a state of constant total amazement. -JP Shanley, Joe vs. the Volcano
  #4   Spotlight this post!  
Unread 18-03-2005, 15:01
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: the %3d in printf

Quote:
Originally Posted by Kris Verdeyen
The 3 is the number of displayed digits.

If you use a number there, it will print leading zeros to fill up the number, up to 3. Instead of '1', it will print '001';
Actually, %3d should print ' 1' (space, space, one.) You would need %03d to get '001'.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printf Oddity : Programming Challange DarkAlex Programming 7 21-03-2005 08:12
printf statements do not display in autonomous mode PVC Pirates Programming 3 22-02-2005 15:41
Printf symbol undefined? Help schenkin Programming 3 08-02-2005 16:14
Default Code and printf WilsonDJ00 Programming 2 22-01-2005 16:39
Anyone with a replacement Printf? Larry Barello Programming 5 19-03-2004 02:20


All times are GMT -5. The time now is 00:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi