#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
using namespace std;
string intToStr(int n)
{
string tmp;
if(n < 0) {
tmp = "-";
n = -n;
}
if(n > 9)
tmp += intToStr(n / 10);
tmp += n % 10 + 48;
return tmp;
}
int main()
{
fstream file_load_1;
fstream file_load_2;
fstream file_save_1;
fstream file_save_2;
int numer;
cout<<"Podaj numerek: ";
cin>>numer;
file_load_1.open("loadlink.txt",ios::in|ios::out);
file_save_1.open("savelink.txt",ios::in|ios::out|ios::ate);
int num1 = numer;
string data;
if(file_load_1.good()&&file_save_1.good())
{
while(!file_load_1.eof())
{
string str1 = "Wideo[";
str1 += intToStr(num1);
str1 += "]=['";
getline(file_load_1, data);
str1 += data;
str1 += "'];";
file_save_1 << str1 << endl;
num1++;
}
}
else cout<<"lel problem";
num1 = numer;
file_load_2.open("loadtitle.txt",ios::in|ios::out);
file_save_2.open("savetitle.txt",ios::in|ios::out|ios::ate);
if(file_load_2.good()&&file_save_2.good())
{
while(!file_load_2.eof())
{
string str1 = "Wideo1[";
str1 += intToStr(num1);
str1 += "]=['";
getline (file_load_2, data);
str1 += data;
str1 += "'];";
file_save_2 << str1 << endl;
num1++;
}
}
else cout<<"lel problem";
cout<<"koniec"<<endl;
getch();
return 0;
}