# PetscOptionsGetString

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

### Synopsis

    #include "petsc.h"
    PetscErrorCode  PetscOptionsGetString(const char pre[],const char name[],char string[],size_t 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)

### C++ variants

| PetscOptionsGetString(const char b[],char i[],size_t s,PetscTruth *f) |  | -> |  | PetscOptionsGetString(PETSC_NULL,b,i,s,f)

### See Also

PetscOptionsGetInt(), PetscOptionsGetReal(),
PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), PetscOptionsList(), PetscOptionsEList()

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

### Examples

src/mat/examples/tutorials/ex1.c.html
src/mat/examples/tutorials/ex4.c.html
src/mat/examples/tutorials/ex5.c.html
src/ksp/ksp/examples/tutorials/ex10.c.html
src/ksp/ksp/examples/tutorials/ex27.c.html
src/snes/examples/tutorials/ex26.c.html
src/snes/examples/tutorials/ex30.c.html