易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux环境下用c语言写的播放wav文件的小程序

#include <unistd.h>
#include <fcntl.h>
#include
<sys/types.h>
#include <sys/ioctl.h>
#include
<stdlib.h>
#include <stdio.h>
#include
<linux/soundcard.h>
/* 下面的三个参数是跟具体文件相关的,文件什么样,就要设置成什么样 */
#define RATE 11025  
#define SIZE 16    
#define CHANNELS
2  // 1表示单声道,2为立体声
/* ................ */
unsigned char
buf[RATE*SIZE/8]; //buf里面正好放一秒钟的音频,下面的计时还要用
int main()
{
    int fd;
    int wavfd; //wav文件的描述符
    int arg;        /* ..ioctl..... */
    int status;   /*
........ */
                /* ...... */
    fd = open("/dev/dsp",
O_RDWR);      
    if (fd < 0) {
        printf("open of /dev/dsp failed");
       
exit(1);
}
    wavfd = open("a.wav",O_RDONLY);
    if (wavfd
< 0) {
        printf("open of wav failed");
        exit(1);
 
}
 
/* .......... */
    arg = SIZE;
    status = ioctl(fd,
SOUND_PCM_WRITE_BITS, &arg);
    if (status == -1)
        
perror("SOUND_PCM_WRITE_BITS ioctl failed");
    if (arg != SIZE)
        
perror("unable to set sample size");
 
/* .......... */
    arg = CHANNELS;
    status = ioctl(fd,
SOUND_PCM_WRITE_CHANNELS, &arg);
    if (status == -1)
 &nb


相关文档:

转载 写得蛮好的linux学习笔记

linux目录架构
/   根目录
/bin    常用的命令 binary file 的目錄
/boot   存放系统启动时必须读取的档案,包括核心 (kernel) 在内
     /boot/grub/menu.lst   GRUB设置
     /boot/vmlinuz   内核
   ......

Linux常用挂载点和目录

/bin                      存放最常用的命令,所有用户都有执行权限
/boot                    系统引导目 ......

★Linux安装经验(CentOS) alva

(一)中文字体的显示
(首先)用setup命令 开启“setup”对话框  --- 选择“service setup”  把“xfs” disable掉。
然后接下来: 
(1)copy "c:/windows/fonts/simsun.ttc"  to Linux directory :  "/usr/share/fonts/liberation"
(2)edit "/etc/sysconfig/i1 ......

linux makefile编写

一、Makefile的规则
在讲述这个Makefile之前,还是让我们先来粗略地看一看Makefile的规则。
target ... : prerequisites ...
command
...
...
target也就是一个目标文件,可以是Object File,也可以是执行文件。
prerequisites就是,要生成那个target所需要的文件或是目标。
command也就是make需要执行的命令。(任 ......

linux目录架构

/       根目录
/bin         常用的命令   binary   file   的目錄
/boot       存放系统启动时必须读取的档案,包括核心   (kernel)   在内
          /boot/grub/menu.lst       GRUB ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号