comparison sounds/au2h.c @ 1:2846a03bda67

[gaim-migrate @ 10] The other missing files :) committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Thu, 23 Mar 2000 03:13:54 +0000
parents
children 34db9f242899
comparison
equal deleted inserted replaced
0:a5ace2e037bc 1:2846a03bda67
1 #include <stdio.h>
2 #if !(__GLIBC__ < 2)
3 #include <error.h>
4 #endif
5 #include <fcntl.h>
6
7 #define BUF_SIZE 10
8
9 int main(int argc, char *argv[])
10 {
11 int fd;
12 FILE *f;
13 int cnt;
14 int res,x;
15 char buf[BUF_SIZE];
16
17 fd = open(argv[1], O_RDONLY);
18 if (fd < 0) {
19 perror("open");
20 exit(1);
21 }
22 f = fopen(argv[2], "w+");
23 if (!f) {
24 perror("fopen");
25 exit(1);
26 }
27 argv[1][strlen(argv[1])-3]='\0';
28 fprintf(f, "static unsigned char %s[] = {\n", argv[1]);
29 read(fd, buf, 8); /* id & offset */
30 read(fd, buf, 8); /* len & encoding */
31 read(fd, buf, 8); /* rate & count */
32 /* no more click :) */
33
34 while((res = read(fd, buf, BUF_SIZE)) > 0) {
35 for (x=0;x<res;x++)
36 fprintf(f, "%#x, ", buf[x] & 0xff);
37 fprintf(f, "\n");
38 }
39 fprintf(f,"};\n");
40 return 0;
41 }