pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

C portability question

Working on a package, I had problems with (in effect)

        off_t var;
        printf("%ld\n", var);

This crashes on netbsd-i386, since our longs are 4 bytes.  (I didn't
quite see what off_t is, but it's 8 bytes long.)

Anyway -- what is the portable way to printf an off_t, which is (of
course) an opaque type.  I could cast (var) to (long), but that's
clearly wrong (and in fact loses data here for us).

Home | Main Index | Thread Index | Old Index