#include #include /*! * \brief write a row * * Rowio_put() * writes the buffer buf, which holds the data for row n, into * the ROWIO structure r. If the row requested is currently in memory, * the buffer is simply copied into the structure and marked as having been * changed. It will be written out later. Otherwise it is written immediately. * Note that when the row is finally written to disk, the putrow() * routine specified in rowio_setup is called to write row n * to the file. rowio_flush ( r) force pending updates to disk ROWIO *r; * Rowio_flush() forces all rows modified by rowio_put to be written * to the file. This routine must be called before closing the file or releasing * the rowio structure if rowio_put() has been called. * * \param r * \param buf * \param n * \return int */ int rowio_put ( ROWIO *R, char *buf,int row) { int i; int col; char *b; if (row < 0) return 0; for (i = 0; i < R->nrows; i++) if (row == R->rcb[i].row) { b = R->rcb[i].buf; for (col = 0; col < R->len; col++) *b++ = *buf++; R->rcb[i].dirty = 1; return 1; } return ((*R->putrow) (R->fd, buf, row, R->len)); }