#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    australia
    Posts
    13
    Rep Power
    0

    problem printf and text format


    hi

    that should be a simple question but i have some trouble to get the good result:

    i am trying to display several element with a certain format: for example:

    No From Date subject
    1 yann.r@hdhdh.com Mon Mar 16 "sdkfjjkfkjsdkfkdfkj"

    so for example "No" should be right aligned and from should be left align? how to do something like that???

    for a specific size i use :
    **********************************************
    printf("%4u %20s %3s %3s %2s %5s %28s\n", b, _from.adresselec(i).c_str(), _date.dayselec(i).c_str(), _date.monthselec(i).c_str(), _date.daynumselec(i).c_str(), _time.timeselec(i).c_str(), _subject.subjectselec(i).c_str());
    ***********************************************
    the problem is that even if i precise %3s, it prints 4s how is this possible?

    last question: how to print a " with printf?


    thanks for all
    yann
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    47
    Rep Power
    15
    The last question: Escape " by using \".
    Code:
    printf("I'm printing a double quote \" ");

IMN logo majestic logo threadwatch logo seochat tools logo