Actual source code: ex1.c
petsc-3.6.4 2016-04-12
2: static char help[] = "Appends to an ASCII file.\n\n";
4: /*T
5: Concepts: viewers^append
6: T*/
8: #include <petscviewer.h>
12: int main(int argc,char **args)
13: {
14: PetscViewer viewer;
15: PetscInt i;
18: PetscInitialize(&argc,&args,(char*)0,help);
19: PetscViewerCreate(PETSC_COMM_WORLD, &viewer);
20: PetscViewerSetType(viewer, PETSCVIEWERASCII);
21: PetscViewerFileSetMode(viewer, FILE_MODE_APPEND);
22: PetscViewerFileSetName(viewer, "test.txt");
23: for (i = 0; i < 10; ++i) {
24: PetscViewerASCIIPrintf(viewer, "test line %d\n", i);
25: }
26: PetscFinalize();
27: return 0;
28: }