fopen(),string,c-str(),无法打开文件,源码如下。有劳各位大神看看
void mfcc(string AudioName)
{
FILE *sourcefile;
ofstream outfile1("yuanshi.txt");
//cout<<AudioName<<endl; 此时可以输出 yuanshi.txt
sourcefile=fopen(AudioName.c_str (),"rb");
if(sourcefile==NULL)
{
cout<<"Can't open yuanshi.txt"<<endl;
exit(0);
}
}
int main()
{
string strAu1="yuanshi.txt";
cout<<strAu1<<endl;
mfcc(strAu1);
return 1;
}
{
FILE *sourcefile;
ofstream outfile1("yuanshi.txt");
//cout<<AudioName<<endl; 此时可以输出 yuanshi.txt
sourcefile=fopen(AudioName.c_str (),"rb");
if(sourcefile==NULL)
{
cout<<"Can't open yuanshi.txt"<<endl;
exit(0);
}
}
int main()
{
string strAu1="yuanshi.txt";
cout<<strAu1<<endl;
mfcc(strAu1);
return 1;
}
...全文
相关推荐
A_STR.C
在C标准库中,一些非常著名的函数组包括stdio.h、stdlib.h、string.h、math.h等头文件提供的函数。
c++ 解压zip文件到指定文件夹
extract_zip(const std::string& zip_path, const std::string& output_dir) { zip_t* zip = zip_open(zip_path.c_str
c++生成xml文件2种办法
*fp;char fname[200];strcpy(fname, FilePathXml.c_str());fp = fopen(fname, "w+");fprintf(fp, "<?
VC中实现GB2312、BIG5、Unicode编码转换的方法
,sizeof(LPWSTR),nLen,file_handle); fclose(file_handle); }}```这段代码首先打开GB2312编码的文件,然后读取其内容到缓冲区。
C++单词分析程序代码
这里使用了`fopen()`函数打开文件,并利用`getc()`函数逐个字符读取文件内容。读取完成后,将文件内容输出至控制台以便验证。


其它技术问题
