#include <oxstd.h>

main()
{
    decl r = 2, c = 2;
    decl x = ones(r,c), file;

    file = fopen("iotest1.txt", "w"); // open for reading

    fprint(file, "%m",x, "%M",2*x, "%#m",3*x, "%#M",4*x);
    fclose(file);

    file = fopen("iotest1.txt");      // open for reading

    decl x1, x2, x3, x4;
    x1 = x2 = x3 = x4 = 0;

    print("file size = ", fsize(file), " bytes");

    fscan(file, "%m", &x1, "%m", &x2,
         "%#m", r, c, &x3, "%#m", r, c, &x4);
    fclose(file);

    print(x1, x2, x3, x4);
}
