易截截图软件、单文件、免安装、纯绿色、仅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   内核
   ......

Materials Studio 5.0 LINUX 版小集群并行安装手记

MS 5.0 LINUX 版小集群并行安装手记
MS 5.0 LINUX 版小集群并行安装手记
这几天重新配置了一下计算环境,顺便记录下来供同行参考,这次以安装MS5.0为例,实际上4.0,4.2,4.4的版本这几天我都配置过了,方法基本相同。
1.操作系统环境说明
客户端要求是Windows XP Professional - SP3或Vista (Business & Enterpris ......

理解linux tr命令

1. tr 命令的功能
tr命名是简化了的sed命令。其主要的功能包括:
a. 用一个字符来替换另外一个字符。
b. 删除字符串中的指定子串。
c. 合并字符串中重复串。
2. 常见的命令格式:
tr -c -d -s ["string1_to_translate_from"] ["string2_to_translate_to"] < input-file
-c 用字符串1中字符集的补集替换此字符集, ......

Linux 下MySQL NDB配置

A) Shutdown management node and data node
devmysql3# ndb_mgm -e shutdown
devmysql4# ndb_mgm -e shutdown
B) Shutdown MySQL proccess
devmysql3# mysqladmin shutdown
devmysql4# mysqladmin shutdown
devmysql3 ip: 10.130.30.217
devmysql4 ip: 10.130.30.218
rpm -ivh MySQL-Cluster-gpl-storage ......

关于linux/unix中SUID /SGID解析

由于用户在UNIX下经常会遇到SUID、SGID的概念,而且SUID和SGID涉及到系统安全,所以用户也比较关心这个问题。
一、 UNIX下关于文件权限的表示方法和解析

SUID 是 Set User ID, SGID 是 Set Group ID的意思。
UNIX下可以用ls -l 命令来看到文件的权限。用ls命令所得到的表示法的格式是类似这样的:-rwxr-xr-x 。下面 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号