# PetscOptionsGetString

Gets the string value for a particular option in the database.

### Synopsis

    #include "petsc.h"
    int PetscOptionsGetString(const char pre[],const char name[],char string[],int len,PetscTruth *flg)

Not Collective

### Input Parameters

| pre | - string to prepend to name or PETSC_NULL
| name | - the option one is seeking
| len | - maximum string length

### Output Parameters

| string | - location to copy string
| flg | - PETSC_TRUE if found, else PETSC_FALSE

### Fortran Note

The Fortran interface is slightly different from the C/C++ interface (len is not used). Sample usage in Fortran follows

          character *20 string
          integer   flg, ierr
          call PetscOptionsGetString(PETSC_NULL_CHARACTER,'-s',string,flg,ierr)

### See Also

PetscOptionsGetInt(), PetscOptionsGetReal(),
PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(), PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(), PetscOptionsList(), PetscOptionsEList()

Level:beginner
Location: src/sys/src/objects/options.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/sys/examples/tutorials/ex4.c.html
src/mat/examples/tutorials/ex1.c.html
src/mat/examples/tutorials/ex4.c.html
src/ksp/examples/tutorials/ex10.c.html
src/ksp/examples/tutorials/ex27.c.html
src/snes/examples/tutorials/ex26.c.html
src/dm/ao/examples/tutorials/ex1.c.html