eksempel på #3:
#include <stdio.h>
#include <string.h>
//**********************************************************************
//
// (ISO-8859-1/IsoLatin1/CP-819 -> CP-850/PC-8-ML) conversion
//
// Notes:
// 0-127 left unchanged
// 128-255 converted (to zero if no equivalence)
//
//**********************************************************************
unsigned char cscvt_to_cp850_table[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,173,189,156,207,190,221,245,249,184,166,174,170,240,169,238,
248,241,253,252,239,230,244,250,247,251,167,175,172,171,243,168,
183,181,182,199,142,143,146,128,212,144,210,211,222,214,215,216,
209,165,227,224,226,229,153,158,157,235,233,234,154,237,231,225,
133,160,131,198,132,134,145,135,138,130,136,137,141,161,140,139,
208,164,149,162,147,228,148,246,155,151,163,150,129,236,232,152
};
void cscvt_to_cp850(char *s1,char *s2)
{
int i;
strcpy(s2,s1);
for(i=0;i<(int)strlen(s1);i++) s2[i]=cscvt_to_cp850_table[(unsigned char)s2[i]];
return;
}
int main()
{
char win[] = "ABCabcÆØÅæøå123";
char dos[100];
cscvt_to_cp850(win,dos);
printf("%s -> %s\n",win,dos);
}