petsc-3.7.1 2016-05-15
Report Typos and Errors

# PetscOptionsGetString

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

### Synopsis

    #include "petscsys.h"
    PetscErrorCode  PetscOptionsGetString(PetscOptions options,const char pre[],const char name[],char string[],size_t len,PetscBool  *set)

Not Collective Many br

### Input Parameters

| options | - options database use NULL for default global database Many br
| pre | - string to prepend to name or NULL Many br
| name | - the option one is seeking Many br
| len | - maximum length of the string including null termination Many br

### Output Parameters

| string | - location to copy string Many br
| set | - PETSC_TRUE if found, else PETSC_FALSE Many br

Many br

### Fortran Note

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

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

Many br

Notes: if the option is given but no string is provided then an empty string is returned and set is given the value of PETSC_TRUE Many br

### Note

Even if the user provided no string (for example -optionname -someotheroption) the flag is set to PETSC_TRUE (and the string is fulled with nulls). Many br

### See Also

PetscOptionsGetInt(), PetscOptionsGetReal(),
PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool(), Many brPetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), Many brPetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), Many brPetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), Many brPetscOptionsFList(), PetscOptionsEList() Many br

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/sys/examples/tutorials/ex5.c.html
src/sys/examples/tutorials/ex9.c.html
src/sys/examples/tutorials/ex10f90.F90.html
src/mat/examples/tutorials/ex1.c.html
src/mat/examples/tutorials/ex4.c.html
src/mat/examples/tutorials/ex5.c.html
src/mat/examples/tutorials/ex9.c.html
src/mat/examples/tutorials/ex10.c.html
src/mat/examples/tutorials/ex12.c.html
src/mat/examples/tutorials/ex16.c.html
src/ksp/ksp/examples/tutorials/ex10.c.html