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

C/C++ API Documentation | 2025.2

# ClientUser::Edit( FileSys *, Error * )

Bring up the given file in a text editor. Called by all `p4` commands that edit specifications.

Virtual? | Yes |
Class | `ClientUser` |
Arguments | `FileSys *f1` | the file to be edited
| `Error *e` | an `Error` object
Returns | `void` |

## Notes

The `FileSys *` argument to `Edit()` refers to a client temp file that contains the specification that is to be given to the server. `Edit()` does not send the file to the server; its only job is to modify the file. In the default implementation, `Edit()` does not return until the editor has returned.

There is also a three-argument version of `Edit()`, for which the default two-argument version is simply a wrapper. The three-argument version takes an `Enviro` object as an additional argument, and the two-argument version simply passes the member variable `enviro` as this argument. Only the two-argument version is virtual.

## Example

The `p4 client` command is one of several P4 Server commands that use `ClientUser::Edit()` to allow the user to modify a specification. When the command is executed, the server sends the client specification to the client machine, where it is held in a temp file. `Edit()` is then called with that file as an argument, and an editor is spawned. When the editor closes, `Edit()` returns, and the temp file is sent to the server.

To allow modification of a specification by other means, such as a customized dialog or an automated process, create a subclass of `ClientUser` that overrides the `Edit()` method and use this subclass in place of `ClientUser`.

Suppose that you have already written a function that takes a `FileSys` as input, opens a custom dialog, and returns when the file has been modified. Replace the body of `Edit()` in your subclass with a call to your function, as follows:

    void MyClientUser::Edit( FileSys *f1, Error *e )
    {
        MyDialog( f1 );
    }

Your search for returned results