PIPS
gen_floats.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <unistd.h>
7 
8 int main(int argc, char** argv)
9 {
10  if (argc < 2)
11  {
12  fprintf(stderr, "Usage: %s nb_floats\n", argv[0]);
13  return EXIT_FAILURE;
14  }
15 
16  int i;
17  int n = atoi(argv[1]);
18  unsigned int seed;
19  int frand = open("/dev/urandom", O_RDONLY);
20  read(frand, &seed, sizeof(unsigned int));
21  close(frand);
22 
23  srand(seed);
24  for (i=0; i < n; i++) {
25  float f = (float) rand();
26  fwrite(&f, sizeof(float), 1, stdout);
27  }
28  fflush(stdout);
29 
30  return EXIT_SUCCESS;
31 }
int main(int argc, char **argv)
Definition: gen_floats.c:8
#define EXIT_SUCCESS
NetBSD 5.0 mis-defines NULL.
Definition: stdlib.in.h:103
#define EXIT_FAILURE
Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere with proper operation of xarg...
Definition: stdlib.in.h:108
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static Menu_item close
Definition: xv_log.c:66