The following functions read numeric vales from a CFILE. All values are stored in the file in Intel (little-endian) format. These functions will convert to big-endian if required. These funtions will exit the program with an error if the value cannot be read, so do not call these if you don't require the data to be present. Read and return an integer (32 bits) Throws an exception of type (cfile_
| 677 | // Read and return an integer (32 bits) |
| 678 | // Throws an exception of type (cfile_error *) if the OS returns an error on read |
| 679 | int32_t cf_ReadInt(CFILE *cfp, bool little_endian) { |
| 680 | int32_t i; |
| 681 | cf_ReadBytes((uint8_t *)&i, sizeof(i), cfp); |
| 682 | return little_endian ? D3::convert_le(i) : D3::convert_be(i); |
| 683 | } |
| 684 | // Read and return a int16_t (16 bits) |
| 685 | // Throws an exception of type (cfile_error *) if the OS returns an error on read |
| 686 | int16_t cf_ReadShort(CFILE *cfp, bool little_endian) { |