Changeset 38553 for trunk/Ohana/src/libfits/table/F_write_T.c
- Timestamp:
- Jun 25, 2015, 10:41:05 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libfits/table/F_write_T.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/table/F_write_T.c
r38441 r38553 5 5 int gfits_write_table (char *filename, FTable *table) { 6 6 7 FILE *f; 8 int status; 9 10 status = TRUE; 11 12 f = fopen (filename, "a+"); 7 FILE *f = fopen (filename, "a+"); 13 8 if (f == (FILE *) NULL) return (FALSE); 14 9 15 status = fseeko (f, 0LL, SEEK_END); /* write table to end of file! */10 int status = fseeko (f, 0LL, SEEK_END); /* write table to end of file! */ 16 11 if (status) { perror ("fseeko: "); return (FALSE); } 17 12 status = gfits_fwrite_table (f, table); … … 25 20 26 21 off_t Nbytes; 27 22 23 # ifdef OHANA_MEMORY 24 { // check memory before writing: 25 // memblock of supplied pointer 26 OhanaMemblock *myBlock = (OhanaMemblock *) table[0].buffer - 1; 27 myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory"); 28 myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory"); 29 myAssert (myBlock->size >= table[0].datasize, "overflow"); 30 } 31 # endif 32 28 33 Nbytes = fwrite (table[0].buffer, sizeof(char), table[0].datasize, f); 29 if (Nbytes != table[0].datasize) { perror ("fwrite: "); return (FALSE); } 34 if (Nbytes != table[0].datasize) { 35 perror ("fwrite: "); 36 return (FALSE); 37 } 30 38 return (TRUE); 31 39 }
Note:
See TracChangeset
for help on using the changeset viewer.
