* Checked getc. */
| 88 | * Checked getc. |
| 89 | */ |
| 90 | static char getChar(CSV &csv) |
| 91 | { |
| 92 | char c = getc(csv.stream); |
| 93 | if (ferror(csv.stream)) |
| 94 | error("failed to parse CSV file \"%s\" at line %u: %s", csv.filename, |
| 95 | csv.lineno, strerror(errno)); |
| 96 | if (feof(csv.stream)) |
| 97 | return EOF; |
| 98 | if (!isascii(c)) |
| 99 | error("failed to parse CSV file \"%s\" at line %u; file contains a " |
| 100 | "non-ASCII character `\\x%.2X'", csv.filename, csv.lineno, |
| 101 | (unsigned)c); |
| 102 | if (c == '\n') |
| 103 | csv.lineno++; |
| 104 | return c; |
| 105 | } |
| 106 | |
| 107 | /* |
| 108 | * Checked ungetc |