Actual source code: ex1.c


  2: static char help[] = "Appends to an ASCII file.\n\n";

  4: #include <petscviewer.h>

  6: int main(int argc, char **args)
  7: {
  8:   PetscViewer viewer;
  9:   PetscInt    i;

 12:   PetscInitialize(&argc, &args, (char *)0, help);
 13:   PetscViewerCreate(PETSC_COMM_WORLD, &viewer);
 14:   PetscViewerSetType(viewer, PETSCVIEWERASCII);
 15:   PetscViewerFileSetMode(viewer, FILE_MODE_APPEND);
 16:   PetscViewerFileSetName(viewer, "test.txt");
 17:   for (i = 0; i < 10; ++i) PetscViewerASCIIPrintf(viewer, "test line %" PetscInt_FMT "\n", i);
 18:   PetscViewerDestroy(&viewer);
 19:   PetscFinalize();
 20:   return 0;
 21: }

 23: /*TEST

 25:    test:

 27: TEST*/