comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:5242703e91d3
1 /*
2 stof.c binary short-to-float conversion.
3 --------
4
5 */
6
7 #include <stdio.h>
8 #include <math.h>
9 #include "options.h"
10
11 char applic[] = "short to float data-type conversion." ;
12
13 static char *helpstr ;
14
15 static Options option[] = {
16 { "help" , "off" , &helpstr , "help" , DEBUG },
17 ( char * ) 0 } ;
18
19
20 main(argc, argv)
21 int argc ;
22 char *argv[] ;
23 {
24 FILE *fp ;
25 short X;
26 float Y;
27
28 fp = openopts( option,argc,argv ) ;
29 if ( !isoff( helpstr ) )
30 helpopts( helpstr, argv[0], applic, option ) ;
31
32 while ( fread( &X, sizeof(short), 1, fp ) ) {
33 Y = (float)X ;
34 fwrite( &Y, sizeof(float), 1, stdout);
35 }
36
37 fclose(fp);
38 exit(0);
39 }
40
41