fread documentation (patch)

Teemu Ikonen <[email protected]> Fri, 14 Nov 2003 18:01:12 +0200
Newsgroups gmane.comp.gnu.octave.sources
Message-ID <[email protected]>
Hi,

Attached is a documentation patch to fread, which adds unsigned integer
types to the list of supported formats.

A quick look at the sources reveals that reading 64-bit integers is only
supported if SIZEOF(long) == 64 in the architecture in question. In i386 I
this is obviously not the case and I get:

> a = fread(fid, "int64");
error: unable to find matching native data type for int64
error: fread: invalid data type specified

A 64-bit int should fit nicely into a 64-bit double (although it loses
information), so this architecture dependent limitation is kind of
arbitrary. Perhaps there's not an easy fix to this problem?

Best wishes,

Teemu
file-io.cc.patch (text/plain, 584 B)
--- orig/octave/src/file-io.cc
+++ mod/octave/src/file-io.cc
@@ -1181,6 +1181,7 @@
 \n\
 @item \"unsigned char\"\n\
 @itemx \"uchar\"\n\
+@itemx \"uint8\"\n\
 Unsigned character.\n\
 \n\
 @item \"short\"\n\
@@ -1216,11 +1217,17 @@
 \n\
 @item \"integer*2\"\n\
 @itemx \"int16\"\n\
-Two byte integer.\n\
+Two byte signed integer.\n\
 \n\
 @item \"integer*4\"\n\
 @itemx \"int32\"\n\
-Four byte integer.\n\
+Four byte signed integer.\n\
+\n\
+@item \"uint16\"\n\
+Two byte unsigned integer.\n\
+\n\
+@item \"uint32\"\n\
+Four byte unsigned integer.\n\
 @end table\n\
 \n\
 @noindent\n\