It works. Thank you very much.
> On May 27, 2014, at 1:40 PM, Satish Balay <[email protected]> wrote: > >> On Tue, 27 May 2014, Likun Tan wrote: >> >> Hello, >> >> I want to create and write my simulation result in a binary file called >> result.dat, but I want to set my file in a different folder, say >> /home/username/output >> >> I am using >> >> PetscViewerBinaryOpen(PETSC_COMM_WORLD, result.dat, FILE_MODE_WRITE, & view) >> >> But this will create the file in the current folder by default. How could I >> modify the command to set a new path? Thank you. > > You should be able to do: > > PetscViewerBinaryOpen(PETSC_COMM_WORLD, "/home/username/output/result.dat", > FILE_MODE_WRITE, & view) > > [or specify the path to the output file at runtime and use > PetscOptionsGetString() to extract this string and use with > PetscViewerBinaryOpen(). For ex: check '-f0' usage in > src/ksp/ksp/examples/tutorials/ex10.c] > > Satish > >
