1
0
Fork 0
skibidifetch/scripts/gen_audio.c
Ari Archer 8ffe38dc1f
i hate shellscripting :(
Signed-off-by: Ari Archer <ari@ari.lt>
2024-05-04 02:09:28 +03:00

29 lines
534 B
C

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
int main(void) {
int fd;
off_t size, idx;
unsigned char *buf;
fd = open("audio.ogg", O_RDONLY);
size = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
buf = malloc(size);
read(fd, buf, size);
puts("#include <stdint.h>\nconst unsigned char audio[]={");
for (idx = 0; idx < size; ++idx)
printf("%u,", buf[idx]);
puts("};const uint64_t audio_size=sizeof(audio);");
free(buf);
return 0;
}