资源简介
使用方法:将要处理的wav文件放在input文件夹,运行exe文件,生成的文件在output文件夹中。大家可以根据此程序进行修改以现在更加丰富的功能。建议大家熟悉wav文件的文件头内容。

代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
struct file_name_list
{
char fileName[260];
}file_name_list[1000];
int number=0;//input文件数目
//string sRoot = “F:\\“;
//string sSuffix = “\\大三下\\信安大赛\\代码\\any_wav_cut\\input\\*.*“; // 后缀
string sRoot = ““;
string sSuffix = “input\\*.*“; // 后缀
void Move(string sPath);
int get_filelist()
{
Move(sRoot);
}
void Move(string sPath)
{
struct _finddata_t file;
long hFile hFileNext;
string sPathLast = sPath + sSuffix; // sPathLast = “c:\test\*.*“
cout< hFile = _findfirst(sPathLast.c_str() &file);
if(hFile == -1)
{
cout<<“文件不存在.“< }
else
{
//cout< }
hFileNext = _findnext(hFile &file);
while(_findnext(hFile &file) == 0)
{
if(file.attrib == _A_SUBDIR)
{
string sAddPath = sPath; sAddPath += “\\“;
sAddPath += file . name;
//cout<<“目录:“< Move(sAddPath);
}
else{
string sAddPath = sPath;
sAddPath += “\\“;
sAddPath += file . name;
//cout<<“文件:“< //cout< for(int j=0;j<260;j++)
{file_name_list[number].fileName[j]=file.name[j];}
number=number+1;
}
}
}
int wav_cut(char filename[]int time)
{
char fileName[260];
printf(“%d\n“time);
unsigned char ch[100];//用来存储wav文件的头信息
FILE *fp;
sprintf(fileName“input/%s“ filename);
printf(“%s\n“fileName);
fp=fopen(fileName“rb“);//为读,打开一个wav文件
printf(“%s\n“fileName);
if(fp==NULL) //若打开文件失败,退出
{
printf(“can‘t open this file\n“);
system(“PAUSE“);
exit(0);
}
for(int i=0;i<100;i++)
{
ch[i]=fgetc(fp); //每次读取一个字符,存在数组ch中
if(i%16==0) //每行输出16个字符对应的十六进制数
printf(“\n“);
if(ch[i]<16) //对小于16的数,在前面加0,使其用8bit显示出来
printf(“0%x “ch[i]);
else
printf(“%x “ch[i]);
}
int data_flag;
for(int i=32;i<100;i++)//find data_falg
{
if(ch[i]==‘t‘&&ch[i-1]==‘a‘&&ch[i-2]==‘d‘&&ch[i+1]==‘a‘)
{
data_flag=i-2;
break;
}
}
printf(“data_flag:%d\n“data_flag);
int bytepermin=*((int*)&ch[28]);//ch[31]*(16*16*16*16*16*16)+ch[30]*(16*16*16*16)+ch[29]*(16*16)+ch[28]; //每秒字节数
printf(“\nbytepermin:%d\n“bytepermin);
int datasize=*((int*)&ch[data_flag+4]);//ch[data_falg+7]*(16*16*16*16*16*16)+ch[data_falg+6]*(16*16*16*16)+ch[data_falg+5]*(16*16)+ch[data_falg+4];//data长度
printf(“\ndatasize:%d\n“
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5409 2014-04-09 18:26 any_wav_cut\any_wav_cut.cpp
文件 1320050 2014-04-09 21:45 any_wav_cut\any_wav_cut.exe
文件 9360098 2014-07-02 15:09 any_wav_cut\input\let.wav
目录 0 2014-07-22 20:56 any_wav_cut\input
目录 0 2014-07-22 20:56 any_wav_cut\output
目录 0 2014-07-22 20:56 any_wav_cut
----------- --------- ---------- ----- ----
10685557 6
相关资源
- 国际象棋的qt源代码
- 操作系统c语言模拟文件管理系统844
- C语言开发实战宝典
- C++中头文件与源文件的作用详解
- C语言代码高亮html输出工具
- 猜数字游戏 c语言代码
- C语言课程设计
- 数字电位器C语言程序
- CCS FFT c语言算法
- 使用C语言编写的病房管理系统
- 通信过程中的RS编译码程序(c语言)
- 计算机二级C语言上机填空,改错,编
- 用回溯法解决八皇后问题C语言实现
- 简易教务管理系统c语言开发文档
- 操作系统课设 读写者问题 c语言实现
- 小波变换算法 c语言版
- C流程图生成器,用C语言代码 生成C语
- 3des加密算法C语言实现
- 简单的C语言点对点聊天程序
- 单片机c语言源程序(51定时器 八个按
- 个人日常财务管理系统(C语言)
- c语言电子商务系统
- 小甲鱼C语言课件 源代码
- 将图片转换为C语言数组的程序
- C语言实现的一个内存泄漏检测程序
- DES加密算法C语言实现
- LINUX下命令行界面的C语言细胞游戏
- 用单片机控制蜂鸣器播放旋律程序(
- 学校超市选址问题(数据结构C语言版
- 电子时钟 有C语言程序,PROTEUS仿真图
评论
共有 条评论