write to a char* instead of stdout

This is a discussion on write to a char* instead of stdout within the C Programming forums, part of the General Programming Boards category; I would like to write the message to a char* instead of to stdout Code: void QTUtility::error( char *msg,...) { ...

  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
    99
    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, 03:17 PM
  3. stdout with JNI
    By GoLuM83 in forum C Programming
    Replies: 4
    Last Post: 12-14-2006, 12: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, 06:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21