CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Posts
    1,134

    A REALLY Dumb Question

    Either I missed this class in Elementary Programming, or perhaps Mary-Jane had her see-through blouse on, but I'm at a loss for this: What format string would I use (eg., in a printf() call) to right-justify a number with blank fill?

    For example, if the number is 12 and I have a 4-character field, I want to print " 12".
    Regards
    Robert Thompson

  2. #2
    Join Date
    Oct 2002
    Location
    Austria
    Posts
    1,284

    Re: A REALLY Dumb Question

    Code:
    int x = 12;
    printf("%4d\n", x );
    Kurt

  3. #3
    Join Date
    Oct 2002
    Posts
    1,134

    Re: A REALLY Dumb Question

    Told you it was a dumb question. I could swear that didn't work for me in the project, but you are absolutely right. Maybe I should stop thinking about Mary-Jane....
    Regards
    Robert Thompson

  4. #4
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: A REALLY Dumb Question

    i feel with you man, i cant stop thinking about this girl i know either ... and i need the guts to tell her how i feel about her

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured