Skip to main content
`Ctrl`+`K`

# PetscFileMode

Access mode for a file.

## Synopsis

    typedef enum {
      FILE_MODE_UNDEFINED     = -1,
      FILE_MODE_READ          = 0,
      FILE_MODE_WRITE         = 1,
      FILE_MODE_APPEND        = 2,
      FILE_MODE_UPDATE        = 3,
      FILE_MODE_APPEND_UPDATE = 4
    } PetscFileMode;

## Values

- `FILE_MODE_UNDEFINED` - initial invalid value

- `FILE_MODE_READ` - open a file at its beginning for reading

- `FILE_MODE_WRITE` - open a file at its beginning for writing (will create if the file does not exist)

- `FILE_MODE_APPEND` - open a file at end for writing

- `FILE_MODE_UPDATE` - open a file for updating, meaning for reading and writing

- `FILE_MODE_APPEND_UPDATE` - open a file for updating, meaning for reading and writing, at the end

## See Also

`PetscViewerFileSetMode()`

## Level

beginner

## Location

include/petscsystypes.h

## Examples

src/dm/impls/plex/tutorials/ex19.c
src/sys/classes/viewer/tutorials/ex1.c

## Examples

src/dm/impls/stag/tutorials/ex6.c
src/dm/tutorials/ex7.c
src/dm/impls/plex/tutorials/ex5.c
src/dm/tutorials/ex15.c
src/dm/impls/stag/tutorials/ex4.c
src/dm/tutorials/ex10.c
src/dm/tutorials/ex20.c
src/dm/tutorials/ex21.c
src/dm/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex15.c

## Examples

src/ksp/ksp/tutorials/ex10.c
src/dm/impls/plex/tutorials/ex5.c
src/dm/tutorials/ex15.c
src/dm/impls/plex/tutorials/ex16.c
src/ksp/ksp/tutorials/ex75.c
src/dm/tutorials/ex10.c
src/dm/tutorials/ex9.c
src/dm/impls/plex/tutorials/ex15.c

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