# PetscViewerASCIIOpenWithFILE
Given an open file creates an ASCII viewer that prints to it. 
## Synopsis
```
#include "petscviewer.h"   
PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm comm, FILE *fd, PetscViewer *lab)
```
Collective


## Input Parameters

- ***comm -*** the communicator
- ***fd -*** the FILE pointer



## Output Parameter

- ***lab -*** the `PetscViewer` to use with the specified file





## Notes
This `PetscViewer` can be destroyed with `PetscViewerDestroy()`, but the fd will NOT be closed.

If a multiprocessor communicator is used (such as `PETSC_COMM_WORLD`),
then only the first processor in the group uses the file.  All other
processors send their data to the first processor to print.


## See Also
 [](sec_viewers), `MatView()`, `VecView()`, `PetscViewerDestroy()`, `PetscViewerBinaryOpen()`,
`PetscViewerASCIIGetPointer()`, `PetscViewerPushFormat()`, `PETSC_VIEWER_STDOUT_`, `PETSC_VIEWER_STDERR_`,
`PETSC_VIEWER_STDOUT_WORLD`, `PETSC_VIEWER_STDOUT_SELF`, `PetscViewerASCIIOpen()`, `PetscViewerASCIISetFILE()`, `PETSCVIEWERASCII`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/ascii/vcreatea.c.html#PetscViewerASCIIOpenWithFILE">src/sys/classes/viewer/impls/ascii/vcreatea.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/impls/ascii/vcreatea.c)


[Index of all Viewer routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
