* Markus Armbruster, 2005
*/
+/* FIXME normalize terminology: table/rows/columns or file/records/fields */
+
#include <stdio.h>
#include <stdlib.h>
char sep;
char buf[1024];
- for (i = 0; i < MAX_NUM_COLUMNS; i++) {
+ for (i = 0; ; i++) {
values[i].v_type = VAL_NOTUSED;
+ if (i >= MAX_NUM_COLUMNS)
+ return gripe("Too many columns");
+
ch = getc(fp);
ungetc(ch, fp);
"Expected space or newline as field separator found %c",
sep);
}
- if (i >= MAX_NUM_COLUMNS)
- return gripe("Too many columns");
if (i == 0)
return gripe("No columns read");
values[++i].v_type = VAL_NOTUSED;