例子1:读char* 保存char*
const char filename[] = "D:\\td_work\\tdvad\\pcm\\new_mp3.mp3"; // 读取的文件
FILE* fp = nullptr;
fopen_s(&fp,filename, "rb");
if (fp != nullptr)
{
fseek(fp, 0, SEEK_END);
long fileSize = ftell(fp);
fseek(fp, 0, SEEK_SET);
{
char* buff = new char[fileSize];
memset(buff, 0, fileSize);
int nRead = fread(buff, sizeof(char), fileSize, fp);
const char dst[] = "D:\\td_work\\tdvad\\pcm\\new_mp3_1111111.mp3"; // 保存的文件
FILE* fpdst = nullptr;
fopen_s(&fpdst, dst, "wb");
fwrite(buff, sizeof(char), nRead, fpdst);
fclose(fp);
fclose(fpdst);
int ii = 3;
}
}
例子2: 读char* 用short* 保存
std::wstring sFileName = L"D:\\td_work\\tdvad\\pcm\\new_mp3.mp3";
FILE* fp = nullptr;
_wfopen_s(&fp,sFileName.c_str(), L"rb");
if (fp != nullptr)
{
fseek(fp, 0, SEEK_EN