7 char *cmdsink = "./IPC/SDR-1000-0-commands.fifo",
8 *specsrc = "./IPC/SDR-1000-0-spec.fifo";
16 main(int argc, char **argv) {
17 int i = 0, j, k, lab = getpid();
19 if (!(cmdfp = fopen(cmdsink, "r+")))
20 perror(cmdsink), exit(1);
21 if (!(spcfp = fopen(specsrc, "r+")))
22 perror(specsrc), exit(1);
30 fprintf(cmdfp, "reqSpectrum %d\n", lab);
33 if (fread((char *) &label, sizeof(int), 1, spcfp) != 1)
34 perror("fread spectrum label"), exit(1);
36 if (fread((char *) spec, sizeof(float), DEFSPEC, spcfp) != DEFSPEC)
37 perror("fread spec"), exit(1);
39 printf("%d <%d>", i++, label);
42 for (k = 1; k < DEFSPEC; k++)
43 if (spec[k] > spec[j]) j = k;
44 printf(" [%d %g]\n", j, spec[j]);