Thread: Using a particular DebugOutput Function

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    222

    Using a particular DebugOutput Function

    I'm trying to use the following debug output function:

    Code:
    VOID
    cdecl
    CPSUIDbgPrint
    (
        LPSTR   pszFormat,
        ...
    )
    /*++
    
    Routine Description:
    
        This fucntion output the debug informat to the debugger
    
    
    Arguments:
    
        pszFormat   - format string
    
        ...         - variable data
    
    
    Return Value:
    
    
        VOID
    
    --*/
    {
        va_list         vaList;
        static TCHAR    OutBuf[768];
    #ifdef UNICODE
        static WCHAR    FormatBuf[256];
    #endif
        //
        // We assume that UNICODE flag is turn on for the compilation, bug the
        // format string passed to here is ASCII version, so we need to convert
        // it to LPWSTR before the wvsprintf()
        //
    
        va_start(vaList, pszFormat);
    
    #ifdef UNICODE
        MultiByteToWideChar(CP_ACP, 0, pszFormat, -1, FormatBuf, COUNT_ARRAY(FormatBuf));
        StringCchVPrintf(OutBuf, COUNT_ARRAY(OutBuf), FormatBuf, vaList);
    #else
        StringCchVPrintf(OutBuf, COUNT_ARRAY(OutBuf), pszFormat, vaList);
    #endif
        va_end(vaList);
    
        OutputDebugString((LPTSTR)OutBuf);
        OutputDebugString(TEXT("\n"));
    }
    The problem that I'm experiencing with this usage:
    Code:
    CPSUIDbgPrint("CPSUIFunc - Property Sheet Being Created");
    is that I'm experiencing compiler error saying that it doesn't recognize what the code after this line is doing. Is there something fundamentally wrong on how I used the debug output (it looked like from the implementation to be used like a printf function or similar)?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Your usage looks fine to me. Maybe the error is elsewhere.

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    I found out from other lines of the code that uses that function on its usage, so I guess I solved the problem now. Thanks for replying.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM