#include <oxstd.h>
main()
{
    decl file, x;
    decl s, r, c, rc8;

    x = rann(2,3);
    x[0][] = double("tinker");
    savemat("iotest7.fmt", x);
                // open mode: read, binary, little-endian
    file = fopen("iotest7.fmt", "rbe");
    fread(file, &s, 'c', 4);

    if (s == "\xDD\xEE\x86")
        println("signature OK");
    else
    {   println("signature NOT OK!");
        exit(1);
    }

    fread(file, &r, 'i');
    fread(file, &c, 'i');
    println("rows=", r, " columns=", c);

    fread(file, &rc8, 'i');
    fread(file, &x, 'f', r, c);
    println("-1 indicates eof: ", fread(file, &s, 'c', 1));
    if (feof(file))
        println("Was indeed end of file.");

    fclose(file);

    println(string(x[0][0]), x[1:][]);
}
