Mercurial > pidgin
annotate sounds/au2h.c @ 827:cc07bbd39472
[gaim-migrate @ 837]
would help if it worked
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 01 Sep 2000 21:58:15 +0000 |
parents | 7ac742be351d |
children | 3deadbe50737 |
rev | line source |
---|---|
1 | 1 #include <stdio.h> |
2 #if !(__GLIBC__ < 2) | |
3 #include <error.h> | |
4 #endif | |
5 #include <fcntl.h> | |
200
bc117fbcf527
[gaim-migrate @ 210]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
10
diff
changeset
|
6 #include <unistd.h> |
469 | 7 #include <stdlib.h> |
8 #include <string.h> | |
1 | 9 |
10 #define BUF_SIZE 10 | |
11 | |
12 int main(int argc, char *argv[]) | |
13 { | |
14 int fd; | |
15 FILE *f; | |
16 int res,x; | |
17 char buf[BUF_SIZE]; | |
18 | |
19 fd = open(argv[1], O_RDONLY); | |
20 if (fd < 0) { | |
21 perror("open"); | |
22 exit(1); | |
23 } | |
24 f = fopen(argv[2], "w+"); | |
25 if (!f) { | |
26 perror("fopen"); | |
27 exit(1); | |
28 } | |
29 argv[1][strlen(argv[1])-3]='\0'; | |
30 fprintf(f, "static unsigned char %s[] = {\n", argv[1]); | |
31 read(fd, buf, 8); /* id & offset */ | |
32 read(fd, buf, 8); /* len & encoding */ | |
33 read(fd, buf, 8); /* rate & count */ | |
34 /* no more click :) */ | |
35 | |
36 while((res = read(fd, buf, BUF_SIZE)) > 0) { | |
37 for (x=0;x<res;x++) | |
38 fprintf(f, "%#x, ", buf[x] & 0xff); | |
39 fprintf(f, "\n"); | |
40 } | |
41 fprintf(f,"};\n"); | |
10 | 42 fclose(f); |
1 | 43 return 0; |
44 } |