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

C/C++ API Documentation | 2025.1

# ClientUser::OutputInfo( char, const char * )

Output tabular data.

Virtual? | Yes |
Class | `ClientUser` |
Arguments | `char level` | the indentation "level" of the output
| `const char *data` | one line of output
Returns | `void` |

## Notes

`OutputInfo()` is called by the server during most P4 Server commands; its most common use is to display listings of information about files. Any output not printed with `OutputInfo()` is typically printed with `OutputText()`. Running `p4 -s <command>` indicates whether any given line of output is "info" or "text".

In the default implementation of `OutputInfo()`, one “…​” string is printed per "level". Values given as "levels" are either `0`, `1`, or `2`. The "data" passed is generally one line, without a line break; `OutputInfo()` adds the newline when it prints the output.

To capture information directly from P4 Server commands for parsing or storing rather than output to `stdout`, it is usually necessary to use an alternate implementation of `OutputInfo()`.

2002.1 and newer servers do not call `OutputInfo()` to display information. Instead, they call `Message()`. The default implementation of `Message()` calls `OutputInfo()` if its argument represents information instead of an error; older code that uses `OutputInfo()` can be used with the newer API and newer servers, so long as the default implementation of `Message()` is retained.

## Example

The `p4 filelog` command produces tabular output:

Copy

    &gt; p4 filelog final.c
    //depot/final.c
    ... #3 change 703 edit on 2001/08/24 by testuser@shire (text) 'fixed'
    ... ... copy into //depot/new.c#4
    ... #2 change 698 edit on 2001/08/24 by testuser@shire (text) 'buggy'
    ... ... branch into //depot/middle.c#1
    ... #1 change 697 branch on 2001/08/24 by testuser@shire (text) 'test'
    ... ... branch from //depot/old.c#1,#3

Each line of output corresponds to one call to `OutputInfo()`. The first line of output has a level of '0', the line for each revision has a level of '1', and the integration record lines have levels of '2'. (The actual "data" text for these lines does not include the “…​” strings.)

To alter the way in which "info" output from the server is handled, create a subclass of `ClientUser` and provide an alternate implementation of `OutputInfo()`.

For example, to capture output in a set of `StrBuf` variables rather than display it to `stdout`, your `ClientUser` subclass must contain three `StrBufs`, one for each level of info output, as follows:

Copy

    void MyClientUser::OutputInfo( char level, const char *data )
    {
        switch( level )
        {
            default:
            case '0':
                myInfo0.Append( data );
                myInfo0.Append( "\n" );
                break;
            case '1':
                myInfo1.Append( data );
                myInfo1.Append( "\n" );
                break;
            case '2':
                myInfo2.Append( data );
                myInfo2.Append( "\n" );
                break;
        }
    }

Your search for returned results