- Timestamp:
- Jun 7, 2015, 11:42:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/table/F_write_T.c
r38329 r38425 14 14 15 15 status = fseeko (f, 0LL, SEEK_END); /* write table to end of file! */ 16 if (status) { perror ("fseeko: "); return (FALSE); } 16 17 status = gfits_fwrite_table (f, table); 17 18 … … 26 27 27 28 Nbytes = fwrite (table[0].buffer, sizeof(char), table[0].datasize, f); 28 29 if (Nbytes != table[0].datasize) return (FALSE); 29 if (Nbytes != table[0].datasize) { perror ("fwrite: "); return (FALSE); } 30 30 return (TRUE); 31 31 } … … 45 45 /* file pointer is at beginning of desired table data */ 46 46 start = ftello (f); 47 if (start < 0) { perror ("ftello: "); return FALSE; } 47 48 48 49 for (i = 0; i < Nrow; i++) { … … 50 51 fseeko (f, offset, SEEK_SET); 51 52 Nbytes = fwrite (table[0].buffer[i], sizeof (char), Nx, f); 52 if (Nbytes != Nx) { return (FALSE); }53 if (Nbytes != Nx) { perror ("fwrite: "); return (FALSE); } 53 54 } 54 55 … … 58 59 59 60 offset = start + Nx*Ny; 60 fseeko (f, offset, SEEK_SET); 61 int status = fseeko (f, offset, SEEK_SET); 62 if (status) { perror ("fseeko: "); return FALSE; } 63 61 64 Nbytes = fwrite (pad, sizeof (char), Npad, f); 62 if (Nbytes != Npad) { return (FALSE); }65 if (Nbytes != Npad) { perror ("fwrite: "); return (FALSE); } 63 66 free (pad); 64 67 … … 97 100 // cursor must be at start of the table (after table header) 98 101 if (fseeko (f, Nskip, SEEK_CUR)) { 102 perror ("fseeko: "); 99 103 fprintf (stderr, "can't seek table start\n"); 100 104 return (FALSE); … … 102 106 103 107 Nwrite = fwrite (ftable[0].buffer, sizeof (char), Nbytes, f); 104 if (Nwrite != Nbytes) { 105 return (FALSE); 106 } 108 if (Nwrite != Nbytes) { perror ("fwrite: "); return (FALSE); } 107 109 108 110 if (Ntotal >= Ndisk) { … … 113 115 free (pad); 114 116 115 if (Nbytes != Npad) return (FALSE);117 if (Nbytes != Npad) { perror ("fwrite: "); return (FALSE); } 116 118 } 117 119
Note:
See TracChangeset
for help on using the changeset viewer.
