sndwin32.c

来自「Audacity是一款用於錄音和編輯聲音的、免費的開放源碼軟體。它可以執行於Ma」· C语言 代码 · 共 73 行

C
73
字号
#include <io.h>#include <fcntl.h>#include <stdio.h>#include <sys/stat.h>#include "snd.h"#include "sndfileio.h"#define PERMISSION 0x0644int snd_file_open(char *fname, int mode){    int file;    if (mode == SND_RDONLY) mode = _O_RDONLY;    else mode = _O_RDWR;    file = _open(fname, mode | _O_BINARY);    return file;}int snd_file_creat(char *fname){    int file = _open(fname, _O_TRUNC | _O_WRONLY |                             _O_CREAT | _O_BINARY, _S_IREAD | _S_IWRITE);    return file;}long snd_file_len(int file){    long len;    struct stat statbuf;    fstat(file ,&statbuf);    len = (long) statbuf.st_size;  /* get length of file */    return len;}long snd_file_read(int fp, char *data, long len){    return read(fp, data, len);}long snd_file_write(int fp, char *data, long len){    return write(fp, data, len);}int snd_file_close(int fp){    return close(fp);}int snd_file_lseek(int file, long offset, int param){    if (param == SND_SEEK_CUR) param = SEEK_CUR;    else if (param == SND_SEEK_SET) param = SEEK_SET;    else param = SEEK_END;    return _lseek(file, offset, param);}void *snd_alloc(size_t s) { return malloc(s); }void snd_free(void *a) { free(a); }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?