[petsc-dev] PetscOptionsGetString

Barry Smith bsmith at mcs.anl.gov
Fri Apr 15 20:25:49 CDT 2011


   This behavior was changed because we wanted to always make sure that strings obtained were null terminated.  When you pass in a string of length 1 there is only room for the null terminator. 

   We could only do the null termination when the the string is larger than one allowing your old code to work. But that is slightly inconsistent handling that case differently. What do you think?

   You might consider using something like PetscOptionsGetEList() instead of PetscOptionsGetString() also.

    Barry



On Apr 15, 2011, at 6:44 PM, Shiyuan wrote:

> Hi, 
> In the version of 3.1-p5, PetscOptionsGetString() can be used to get a char input. It seems that it doesn't work any more in development version. 
>  PetscOptionsGetString(PETSC_NULL,"-Mode",&Mode,1,&flag);
> This gives me a \0. How can I get the input of only one character in dev? 
> Thanks.
> 
> 
> 




More information about the petsc-dev mailing list