无意中发现的
// UC2MP3.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
int _tmain(int argc, _TCHAR* argv[])
{
FILE *fp_r, *fp_w;
uint8_t DatBuf[1000] = { 0 };
if (fopen_s(&fp_r, "my heart will go on.uc", "rb") != 0) //the raw ".uc" file
{
printf("open file failed!\n");
getchar();
exit(1);
}
if (fopen_s(&fp_w, "my heart will go on.mp3", "wb") != 0) //convert result to mp3 file
{
printf("creat file failed!\n");
getchar();
exit(1);
}
printf("start convert...\n");
while (!feof(fp_r))
{
fread_s(DatBuf, sizeof(DatBuf), sizeof(uint8_t), sizeof(DatBuf), fp_r);
for (int i = 0; i < sizeof(DatBuf); i++)
{
DatBuf[i] ^= 0xA3; //actully ,just hexadecimal of 163
}
fwrite(DatBuf, sizeof(DatBuf), sizeof(uint8_t), fp_w);
}
fclose(fp_r);
fclose(fp_w);
printf("finish convert!press any key to exit.\n");
getchar();
return 0;
}