Mercurial > hg > aim92
view tools/stof.c @ 0:5242703e91d3 tip
Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author | tomwalters |
---|---|
date | Fri, 20 May 2011 15:19:45 +0100 |
parents | |
children |
line wrap: on
line source
/* stof.c binary short-to-float conversion. -------- */ #include <stdio.h> #include <math.h> #include "options.h" char applic[] = "short to float data-type conversion." ; static char *helpstr ; static Options option[] = { { "help" , "off" , &helpstr , "help" , DEBUG }, ( char * ) 0 } ; main(argc, argv) int argc ; char *argv[] ; { FILE *fp ; short X; float Y; fp = openopts( option,argc,argv ) ; if ( !isoff( helpstr ) ) helpopts( helpstr, argv[0], applic, option ) ; while ( fread( &X, sizeof(short), 1, fp ) ) { Y = (float)X ; fwrite( &Y, sizeof(float), 1, stdout); } fclose(fp); exit(0); }