Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.1

# ClientUser::OutputError( const char * )

Display a message as an error.

Virtual? | Yes |
Class | `ClientUser` |
Arguments | `const char *errBuf` | the error message
Returns | `void` |

## Notes

The default implementation sends its argument to `stderr`. `OutputError()` is called by functions like `HandleError()`.

## Example

Because the default implementation of `HandleError()` calls it, `OutputError()` is responsible for printing every error message in P4 Server. For example:

    p4 files //nonexistent/...
    nonexistent - no such file(s).

In this case, the argument to `OutputError()` is the array containing the error message "nonexistent - no such file(s)."

To change the way error messages are displayed, create a subclass of `ClientUser` and define an alternate implementation of `OutputError()`.

For example, to print all error messages to `stdout` rather than `stderr`, and precede them with the phrase “!!ERROR!!”, implement `OutputError()` as follows:

    void MyClientUser::OutputError( const char *errBuf )
    {
        printf( "!!ERROR!! " );
        fwrite( errBuf, 1, strlen( errBuf ), stdout );
    }

Your search for returned results