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

C/C++ API Documentation | 2025.2

# ClientUser::Message( Error * )

Output information or errors.

Virtual? | Yes |
Class | `ClientUser` |
Arguments | `Error *e` | an `Error` object containing the message
Returns | `void` |

## Notes

`Message()` is used by 2002.1 and later servers to display information or errors resulting from P4 Server commands. Earlier versions of the P4 Server call `OutputInfo()` to display information, and `HandleError()` to display errors.

The default implementation of `Message()` makes calls to `OutputInfo()` or `HandleError()` as appropriate. If you want your application to be compatible with pre-2002.1 servers, use this default implementation of `Message()` - newer servers will call `Message()`, and older servers will call `OutputInfo()` and `HandleError()` directly.

If you re-implement `Message()` to handle errors and information in a different way, be advised that older servers will still call `OutputInfo()` and `HandleError()` rather than your `Message()` method.

## Example

    > p4 files //depot/proj/...
    //depot/proj/file.c#1 - add change 456 (text)

In this example, the server passes a single `Error` object to the `ClientUser`'s `Message()` method, with a severity of `E_INFO` and text "//depot/proj/file.c#1 - add change 456 (text)". The default `Message()` method detects that this was an "info" message, and passes the text to `OutputInfo()`, which by default sends the text to `stdout`.

To handle messages differently, subclass `ClientUser` and re-implement the `Message()` method (see the preceding note on interoperability with old servers if you do this).

For example, to take all server messages and load them into a `StrBuf` that is a member of your `ClientUser` class, use the following:

    void MyClientUser::Message( Error *err )
    {
        StrBuf buf;
        err->Fmt( buf, EF_PLAIN );
        myBuf.Append( buf );
    }

Your search for returned results