# PetscOptionsInsert
Inserts into the options database from the command line, the environmental variable and a file. 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscOptionsInsert(PetscOptions options, int *argc, char ***args, const char file[])
```
Collective on `PETSC_COMM_WORLD`


## Input Parameters

- ***options -*** options database or NULL for the default global database
- ***argc -*** count of number of command line arguments
- ***args -*** the command line arguments
- ***file -*** [optional] PETSc database file, append ":yaml" to filename to specify YAML options format.
Use NULL or empty string to not check for code specific file.
Also checks ~/.petscrc, .petscrc and petscrc.
Use -skip_petscrc in the code specific file (or command line) to skip ~/.petscrc, .petscrc and petscrc files.



## Options Database Keys

- ***-options_file <filename> -*** read options from a file
- ***-options_file_yaml <filename> -*** read options from a YAML file



## Notes
Since PetscOptionsInsert() is automatically called by `PetscInitialize()`,
the user does not typically need to call this routine. `PetscOptionsInsert()`
can be called several times, adding additional entries into the database.

See `PetscInitialize()` for options related to option database monitoring.




## See Also
 `PetscOptionsDestroy()`, `PetscOptionsView()`, `PetscOptionsInsertString()`, `PetscOptionsInsertFile()`,
`PetscInitialize()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/options.c.html#PetscOptionsInsert">src/sys/objects/options.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/tutorials/ex19.c.html">src/sys/tutorials/ex19.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex22.c.html">src/snes/tutorials/ex22.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex30.c.html">src/snes/tutorials/ex30.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/options.c)


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