Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 112859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:36:40+00:00 2026-05-11T02:36:40+00:00

As of now I’m using below line to print with out dot’s fprintf( stdout,

  • 0

As of now I’m using below line to print with out dot’s

fprintf( stdout, '%-40s[%d]', tag, data); 

I’m expecting the output would be something like following,

 Number of cards..................................[500] Fixed prize amount [in whole dollars]............[10] Is this a high winner prize?.....................[yes] 

How to print out dash or dot using fprintf/printf?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:36:40+00:00Added an answer on May 11, 2026 at 2:36 am

    A faster approach:

    If the maximum amount of padding that you’ll ever need is known in advance (which is normally the case when you’re formatting a fixed-width table like the one you have), you can use a static ‘padder’ string and just grab a chunk out of it. This will be faster than calling printf or cout in a loop.

    static const char padder[] = '......................'; // Many chars  size_t title_len = strlen(title); size_t pad_amount = sizeof(padder) - 1 - title_len;  printf(title); // Output title  if (pad_amount > 0) {     printf(padder + title_len); // Chop! }  printf('[%d]', data); 

    You could even do it in one statement, with some leap of faith:

    printf('%s%s[%d]', title, padder + strlen(title), data); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now I am implementing UDP server to gather sflow datagrams using netty library. Here
Now this is tricky. I am trying to do WAP testing using firefox and
Now that Rails 3 is out, my favorite dev-mode plugin (rails-dev-boost) is broken. I'm
Now this might be a dumb question, but I'm still new to using Visual
Now I have a file with many data in it. And I know the
Now i am working in iPhone application, Using UIImageView to create a animation and
Now that the 3.0 OS & 3Gs are coming out, there will be a
Now I am using something like: dbResult = dbStatement.executeQuery(SELECT COUNT(*) FROM information_schema.tables WHERE table_schema
Now I'm porting my project from Linux to Windows. I've built QJson using QtCreator
now, i want to output the latest article's title list. but i don't want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.