Home
Install
Use
Develop
Support
News
Credits
hosted by
|
11#ifndef __unload_text_h
12#define __unload_text_h
23void unload_text (fitsfile* fptr, const char* table, const char* column,
24 const T* instance, bool verbose = false)
28 fits_movnam_hdu (fptr, BINARY_TBL, const_cast<char* >(table), 0, &status);
31 throw FITSError (status, "unload_text",
32 "fits_movnam_hdu %s", table);
35 fits_get_colnum (fptr, CASEINSEN, const_cast<char* >(column),
42 fits_get_coltype (fptr, colnum, &typecode, &repeat, &width, &status);
44 if (typecode != TSTRING)
45 throw Error (InvalidState, "unload_text",
46 "%s typecode != TSTRING", column);
50 throw Error (FailedSys, "unload_text", "tmpfile");
54 instance->unload (stream);
58 throw error += "unload_text";
62 fseek (stream, 0, SEEK_SET);
64 std::vector<char> text (repeat * 2);
65 char* temp = &(text[0]);
68 while (fgets (temp, repeat, stream) == temp)
73 char* newline = strchr (temp, '\n');
78 std::cerr << "unload_text row=" << row << " line='" << temp << "'" << std::endl;
80 fits_write_col (fptr, TSTRING, colnum, row, 1, 1, &temp, &status);
83 throw FITSError (status, "unload_text",
84 "fits_write_col row=%d", row);
88 std::cerr << "unload_text wrote " << row << " rows" << std::endl;
Generated using doxygen 1.14.0
|