comparison dev/mk-256bytes.c @ 233:bbdefd2ef950

dev: new program mk-256bytes
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 May 2023 21:19:30 +0000
parents
children
comparison
equal deleted inserted replaced
232:8710c94df334 233:bbdefd2ef950
1 /*
2 * This program generates a binary file of 256 bytes, containing every
3 * possible octet value in linearly increasing order. The purpose of this
4 * datum is testing of A-linear-A and mu-linear-mu PCM conversions: we need
5 * to ensure that each of those sequences is an identity transform for all
6 * possible PCM octet values.
7 */
8
9 #include <stdio.h>
10 #include <stdlib.h>
11
12 main(argc, argv)
13 char **argv;
14 {
15 FILE *outf;
16 unsigned val;
17
18 if (argc != 2) {
19 fprintf(stderr, "usage: %s output-bin-file\n", argv[0]);
20 exit(1);
21 }
22 outf = fopen(argv[1], "w");
23 if (!outf) {
24 perror(argv[1]);
25 exit(1);
26 }
27 for (val = 0; val < 256; val++)
28 putc(val, outf);
29 fclose(outf);
30 exit(0);
31 }