output.c 445 Bytes
/***************************************************************
 *
 *	output.c
 *	 the output function
 *
 *	1/3/95		bfs initial version
 *
 */


#include "output.h"

#define	CLIP(x)	if (x > 32767) x = 32767; if (x < -32767) x = -32767;

void
wrout(long data, FILE *out)
{
    short sdata;
    
    CLIP(data);
    sdata = (short)data;

#ifdef ASCII
    fprintf(out, "%hd\n", sdata);
#else
    fwrite(&sdata, sizeof(short), 1, out);
#endif
}