Help needed. Converter

Hello. I need to create converter from CP437 encoding to UTF-8. Firstly, program reads file in one byte at a time. Then if its meaning is >=128 changes symbol into UTF-8.
That's what I have:
1) Function that reads file in one byte at a time:
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
ifstream fin("input.txt");
char c;
while(!fin.eof())
{
fin.get(c);
if(!fin.eof())
cout<<c;
}
}

2) Function that converts decimal integer into UTF-8 symbol:
#include <iostream>
using namespace std;
int main()
{
int d;
cout<<"DEC: ";
cin>>d;
wchar_t c = static_cast<wchar_t>(d);
wcout << "UTF-8: "<< c << endl;
}
How to end it up?
1
2
3
4
5
wchar_t convert(int d)
{
  wchar_t c = static_cast<wchar_t>(d);
  return c;
}
Last edited on
Topic archived. No new replies allowed.