Thread: write to a char* instead of stdout

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    38

    write to a char* instead of stdout

    I would like to write the message to a char* instead of to stdout

    Code:
    void QTUtility::error( char *msg,...)
    {
        va_list ap;
        va_start(ap, msg);
        fprintf(stdout, "\n\nERROR: ");
        vfprintf(stdout, msg, ap);
        fprintf(stdout, "\n\n");
        va_end(ap);
    }
    Can someone tell me how to do this?
    Thanks
    Mark
    Last edited by Ken Fitlike; 08-16-2006 at 07:47 AM. Reason: code tags added

  2. #2
    Registered User
    Join Date
    Aug 2006
    Posts
    100
    Take a look at vsprintf() ?

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Take a look at the C++ forum?


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-12-2008, 12:00 PM
  2. Redirect stdout
    By GoLuM83 in forum C Programming
    Replies: 6
    Last Post: 12-15-2006, 04:17 PM
  3. stdout with JNI
    By GoLuM83 in forum C Programming
    Replies: 4
    Last Post: 12-14-2006, 01:27 PM
  4. Reroute where programs write to
    By willc0de4food in forum C Programming
    Replies: 7
    Last Post: 09-21-2005, 04:48 PM
  5. write in c
    By PutoAmo in forum C Programming
    Replies: 6
    Last Post: 04-03-2002, 07:53 PM