Index: /trunk/psLib/src/fits/psFitsTable.c
===================================================================
--- /trunk/psLib/src/fits/psFitsTable.c	(revision 15247)
+++ /trunk/psLib/src/fits/psFitsTable.c	(revision 15248)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-10-03 21:27:21 $
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-10-09 02:56:23 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -34,4 +34,17 @@
 #define MAX_STRING_LENGTH 256  // maximum length string for FITS routines
 
+long psFitsTableSize(const psFits *fits)
+{
+    PS_ASSERT_FITS_NON_NULL(fits, 0);
+
+    int status = 0;                     // CFITSIO status
+    long numRows;                       // Number of rows
+    if (fits_get_num_rows(fits->fd, &numRows, &status)) {
+        psFitsError(status, true, "Unable to determine number of rows in table.");
+        return 0;
+    }
+
+    return numRows;
+}
 
 psMetadata* psFitsReadTableRow(const psFits* fits,
@@ -388,4 +401,5 @@
 {
     PS_ASSERT_FITS_NON_NULL(fits, false);
+    PS_ASSERT_FITS_WRITABLE(fits, false);
     if (!psFitsMoveLast(fits)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to move to last extension to write table");
@@ -465,4 +479,5 @@
 {
     PS_ASSERT_FITS_NON_NULL(fits, false);
+    PS_ASSERT_FITS_WRITABLE(fits, false);
     PS_ASSERT_ARRAY_NON_NULL(table, false);
 
@@ -719,4 +734,5 @@
 {
     PS_ASSERT_FITS_NON_NULL(fits, false);
+    PS_ASSERT_FITS_WRITABLE(fits, false);
     PS_ASSERT_METADATA_NON_NULL(data, false);
     PS_ASSERT_INT_NONNEGATIVE(row, false);
Index: /trunk/psLib/src/fits/psFitsTable.h
===================================================================
--- /trunk/psLib/src/fits/psFitsTable.h	(revision 15247)
+++ /trunk/psLib/src/fits/psFitsTable.h	(revision 15248)
@@ -5,6 +5,6 @@
  * @author Robert DeSonia, MHPCC
  *
- * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-01-23 22:47:23 $
+ * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-10-09 02:56:23 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -23,4 +23,10 @@
 #include "psMetadata.h"
 #include "psImage.h"
+
+/// Return the number of rows in the current table
+///
+/// The current HDU type must be either PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
+long psFitsTableSize(const psFits *fits ///< FITS file
+                     );
 
 /** Reads a table row.  The current HDU type must be either
