Скрытый текст
Это должен быть экстрактор музыки из touhou project 7. В строке 74 ошибка. Там я пытаюсь сделать имя выходного файла, но не получается соединить 2 строки и число. Как блин это сделать, не понимат.
#include <iostream>#include <fstream>using namespace std;void extract(int start_offset, int intro_length, int total_length, char* out_name){ char ch; std::fstream in; std::fstream out; in[paste][/paste]open("thbgm[paste][/paste]dat", ios::in | ios::binary); out[paste][/paste]open(out_name, ios::out | ios::binary); int total_volume=intro_length+2*(total_length-intro_length); int total_volumet=total_volume; char byte1=total_volumet % 0x100; total_volumet/=0x100; char byte2=total_volumet % 0x100; total_volumet/=0x100; char byte3=total_volumet % 0x100; total_volumet/=0x100; char byte4=total_volumet % 0x100; total_volumet/=0x100; out << "RIFF" << (char) ((int) byte1+0x24) << byte2 << byte3 << byte4 << "WAVEfmt " << (char)0x10 << (char)0x00 << (char)0x00 << (char)0x00 << (char)0x01 << (char)0x00 << (char)0x02 << (char)0x00 << (char)0x44 << (char)0xac << (char)0x00 << (char)0x00 << (char)0x10 << (char)0xb1 << (char)0x02 << (char)0x00 << (char)0x04 << (char)0x00 << (char)0x10 << (char)0x00 << "data" << byte1 << byte2 << byte3 << byte4; in[paste][/paste]seekg(start_offset, ios::beg); for (int i=0;i<intro_length;i++) { in[paste][/paste]get(ch); out << ch; } in[paste][/paste]seekg(start_offset+intro_length, ios::beg); for (int i=0;i<total_length-intro_length;i++) { in[paste][/paste]get(ch); out << ch; } in[paste][/paste]seekg(start_offset+intro_length, ios::beg); for (int i=0;i<total_length-intro_length;i++) { in[paste][/paste]get(ch); out << ch; } in[paste][/paste]clear(); in[paste][/paste]seekg(0, ios::beg); in[paste][/paste]close(); out[paste][/paste]clear(); out[paste][/paste]seekg(0, ios::beg); out[paste][/paste]close();}int main (){ int start_offset[20]; int intro_length[20]; int total_length[20]; start_offset[1]=0x00000010; start_offset[2]=0x00FC7730; start_offset[3]=0x01E8F730; start_offset[4]=0x02A4772C; start_offset[5]=0x041C71B8; start_offset[6]=0x04B3E7B0; start_offset[7]=0x0603E1B0; start_offset[8]=0x07E761B0; start_offset[9]=0x0A7A75B0; start_offset[10]=0x0BF664B0; start_offset[11]=0x0D8700B0; start_offset[12]=0x0EB47CB0; start_offset[13]=0x0F4F30B0; start_offset[14]=0x10D2F4B0; start_offset[15]=0x137CE2B0; start_offset[16]=0x14FD01B0; start_offset[17]=0x173C2A30; start_offset[18]=0x18BC4930; start_offset[19]=0x11C8C1B0; start_offset[20]=0x1276E2B0; intro_length[1]=0x00129300; intro_length[2]=0x002B9F80; intro_length[3]=0x001D2EA0; intro_length[4]=0x00406C58; intro_length[5]=0x0009DE28; intro_length[6]=0x00156E00; intro_length[7]=0x004C9800; intro_length[8]=0x0015E180; intro_length[9]=0x000B6300; intro_length[10]=0x001A5400; intro_length[11]=0x00121C00; intro_length[12]=0x00078800; intro_length[13]=0x002E9E00; intro_length[14]=0x00B1C400; intro_length[15]=0x000F8C00; intro_length[16]=0x0003EF00; intro_length[17]=0x000F8C00; intro_length[18]=0x00055500; intro_length[19]=0x000CA100; intro_length[20]=0x00500B00; total_length[1]=0x00FC7720; total_length[2]=0x00EC8000; total_length[3]=0x00BB7FFC; total_length[4]=0x0177FA8C; total_length[5]=0x009775F8; total_length[6]=0x014FFA00; total_length[7]=0x01E38000; total_length[8]=0x02931400; total_length[9]=0x017BEF00; total_length[10]=0x01909C00; total_length[11]=0x012D7C00; total_length[12]=0x009AB400; total_length[13]=0x0183C400; total_length[14]=0x00F5CD00; total_length[15]=0x01801F00; total_length[16]=0x023F2880; total_length[17]=0x01801F00; total_length[18]=0x01C28000; total_length[19]=0x00AE2100; total_length[20]=0x01060000; for (int i=1;i<20;i++) { cout << "Now extracting track: " << i; extract(start_offset[i], intro_length[i], total_length[i], "track"+(char*)i+"[paste][/paste]wav"); cout << " Complite!\n"; } return 0; }