Skip to main content
`Ctrl`+`K`

# PetscViewerASCIIStdoutSetFileUnit

sets `PETSC_VIEWER_STDOUT_()` to write to a Fortran IO unit

## Synopsis

    #include <petscviewer.h>
    void PetscViewerASCIIStdoutSetFileUnit(PetscInt unit, PetscErrorCode ierr)

## Input Parameter

- unit - the unit number

## Output Parameter

- ierr - the error code

## Notes

Can be called before `PetscInitialize()`

Immediately changes the output for all `PETSC_VIEWER_STDOUT_()` viewers

This may not work currently with some viewers that (improperly) use the `fd` directly instead of `PetscViewerASCIIPrintf()`

With this option, for example, `-log_options` results will be saved to the Fortran file

Any process may call this but only the unit passed on the first process is used

## Fortran Note

Only for Fortran

## Developer Note

`PetscViewerASCIIWORLDSetFilename()` and `PetscViewerASCIIWORLDSetFILE()` could be added

## See Also

`PetscViewerASCIISetFILE()`, `PETSCVIEWERASCII`, `PetscViewerASCIIOpenWithFileUnit()`, `PetscViewerASCIIStdoutSetFileUnit()`, `PETSC_VIEWER_STDOUT_()`, `PetscViewerASCIIGetStdout()`

## Level

intermediate

## Location

src/sys/classes/viewer/impls/ascii/filev.c

Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages