File1: #include <stdio.h>\nint main(int argc, char* argv[])\n{\n  int i;\n  int ret;\n  FILE* pfile;\n  int len=1000;\n\n  int A[1000];\n\n  for (i=0; i<len; i++)\n    A[i]=i;\n\n  pfile = fopen("mytempfile.txt","a+");\n  if (pfile ==NULL)\n  {\n    fprintf(stderr,"Error in fopen()\n");\n  }\n\n#pragma omp parallel for\n  for (i=0; i<len; ++i)\n  {\n    fprintf(pfile, "%d\n", A[i] );\n  }\n\n  fclose(pfile);\n  ret = remove("mytempfile.txt");\n  if (ret != 0)\n  {\n    fprintf(stderr, "Error: unable to delete mytempfile.txt\n");\n  }\n  return 0;\n}\n\n
File2: program DRB049_fprintf_orig_no\n    use omp_lib\n    implicit none\n\n    integer i, ret, len, stat\n    integer :: a(1000)\n    logical :: exist\n\n    len = 1000\n\n    do i = 1, len\n        a(i) = i\n    end do\n\n    inquire(file="mytempfile.txt", exist=exist)\n\n    if (exist) then\n        open(6, file="mytempfile.txt", iostat=stat, status="old", position="append", action="write")\n    else\n        open(6, file="mytempfile.txt", iostat=stat, status="new", action="write")\n    end if\n\n    !$omp parallel do\n    do i = 1, len\n        write(6, *) a(i)\n    end do\n    !$omp end parallel do\n\n    if (stat == 0) close(6, status='delete')\n\nend program