1 static char help[] = "Tests string options with spaces"; 2 3 #include <petscsys.h> 4 5 int main(int argc, char **argv) 6 { 7 char option2[20], option3[30]; 8 PetscBool flg; 9 PetscInt option1; 10 11 PetscFunctionBeginUser; 12 PetscCall(PetscInitialize(&argc, &argv, "ex19options", help)); 13 PetscCall(PetscOptionsGetInt(NULL, 0, "-option1", &option1, &flg)); 14 PetscCall(PetscOptionsGetString(NULL, 0, "-option2", option2, sizeof(option2), &flg)); 15 PetscCall(PetscPrintf(PETSC_COMM_WORLD, "%s\n", option2)); 16 PetscCall(PetscOptionsGetString(NULL, 0, "-option3", option3, sizeof(option3), &flg)); 17 PetscCall(PetscPrintf(PETSC_COMM_WORLD, "%s\n", option3)); 18 PetscCall(PetscFinalize()); 19 return 0; 20 } 21 22 /*TEST 23 24 test: 25 localrunfiles: ex19options 26 27 TEST*/ 28