[project @ 1997-07-27 00:43:10 by sof]
[ghc-hetmet.git] / ghc / tests / programs / dmgob_native1 / generate_vectors.c
1 #include <stdio.h>
2
3 int main ( )
4 {
5   FILE *ptr_output_file;
6
7   int dim;
8   float x[10];
9
10
11   ptr_output_file = fopen("test_data", "wb");
12   if ( ptr_output_file == (FILE *) NULL ) {
13     fprintf(stderr, "Can't open file test_data\n");
14     perror("fopen");
15     exit(1);
16   }
17
18
19   dim = 3;
20   x[0] = 1.0F;
21   x[1] = 2.0F;
22   x[2] = 3.0F;
23   fwrite( &dim, sizeof(int), 1, ptr_output_file );
24   fwrite( x, sizeof(float), dim, ptr_output_file );
25
26   dim = 2;
27   x[0] = 1.0F;
28   x[1] = 2.0F;
29   fwrite( &dim, sizeof(int), 1, ptr_output_file );
30   fwrite( x, sizeof(float), dim, ptr_output_file );
31
32   dim = 4;
33   x[0] = 1.0F;
34   x[1] = 2.0F;
35   x[2] = 3.0F;
36   x[3] = 4.0F;
37   fwrite( &dim, sizeof(int), 1, ptr_output_file );
38   fwrite( x, sizeof(float), dim, ptr_output_file );
39
40   fclose( ptr_output_file );
41   return 0;
42 }