7
#include "G3d_intern.h"
9
/*---------------------------------------------------------------------------*/
11
int G3d_writeInts(int fd, int useXdr, const int *i, int nofNum)
15
char xdrIntBuf[G3D_XDR_INT_LENGTH * 1024];
19
G3d_fatalError("G3d_writeInts: nofNum out of range");
21
if (useXdr == G3D_NO_XDR) {
22
if (write(fd, i, sizeof(int) * nofNum) != sizeof(int) * nofNum) {
23
G3d_error("G3d_writeInts: writing to file failed");
32
xdrmem_create(&xdrEncodeStream, xdrIntBuf, G3D_XDR_INT_LENGTH * 1024,
42
if (!xdr_setpos(&xdrEncodeStream, 0)) {
43
G3d_error("G3d_writeInts: positioning xdr failed");
47
if (!xdr_vector(&xdrEncodeStream, (char *)i, n, sizeof(int),
48
(xdrproc_t) xdr_int)) {
49
G3d_error("G3d_writeInts: writing xdr failed");
53
if (write(fd, xdrIntBuf, G3D_XDR_INT_LENGTH * n) !=
54
G3D_XDR_INT_LENGTH * n) {
55
G3d_error("G3d_writeInts: writing xdr to file failed");
66
/*---------------------------------------------------------------------------*/
68
int G3d_readInts(int fd, int useXdr, int *i, int nofNum)
72
char xdrIntBuf[G3D_XDR_INT_LENGTH * 1024];
76
G3d_fatalError("G3d_readInts: nofNum out of range");
78
if (useXdr == G3D_NO_XDR) {
79
if (read(fd, i, sizeof(int) * nofNum) != sizeof(int) * nofNum) {
80
G3d_error("G3d_readInts: reading from file failed");
89
xdrmem_create(&xdrDecodeStream, xdrIntBuf, G3D_XDR_INT_LENGTH * 1024,
99
if (read(fd, xdrIntBuf, G3D_XDR_INT_LENGTH * n) !=
100
G3D_XDR_INT_LENGTH * n) {
101
G3d_error("G3d_readInts: reading xdr from file failed");
105
if (!xdr_setpos(&xdrDecodeStream, 0)) {
106
G3d_error("G3d_readInts: positioning xdr failed");
110
if (!xdr_vector(&xdrDecodeStream, (char *)i, n, sizeof(int),
111
(xdrproc_t) xdr_int)) {
112
G3d_error("G3d_readInts: reading xdr failed");