Et par metoder:
#include <iostream>
#include <string.h>
#define ae "\\x91"
#define oe "\\x9B"
#define aa "\\x86"
#define AE "\\x92"
#define OE "\\x9D"
#define AA "\\x8F"
std::string ToDos(std::string aInp)
{
static const char Out[] = {0x91, 0x9B, 0x86, 0x92, 0x9D, 0x8F};
static const char In[] = "æøåÆØÅ";
std::string R;
for(size_t i = 0; i < aInp.size(); i++)
{
const char *p;
if((p = strchr(In, aInp[ i ])) != 0)
R += Out[p - In];
else
R += aInp[ i ];
}
return R;
}
int main()
{
std::cout << AE "bler p" aa " et tr" ae " p" aa " en " oe " i " OE "rum " AA << std::endl;
std::cout << ToDos("Rød grød med æbler") << std::endl;
return 0;
}