Hey, I made a function that will automatically conjugate a Spanish verb and I want to put the different conjugations in different Edit Text controls but when I use SetDlgText it comes up with a bunch of i's with accents. Here is the code that I've narrowed it down to.
Here is the function:
int RegConj(char *infin, char conjs[MAX_TENSES*MAX_PERSONS][MAX_LETTERS])
{
char *p;
int val = strlen(infin);
p = (infin + val);//find null
if(*p != 0)
return 0;
p = (p - 2);//p = the a, e, or i in the infinitive ending
val = val - 2;//change val to length of infinitive without the ending
if(*p == 'a')
{
//Present
//YO
strcpy((char *)conjs, infin);
strcpy((char *)conjs+val, "o");
//TU
strcpy((char *)conjs+ 1*MAX_LETTERS, infin);
strcpy((char *)conjs+val + MAX_LETTERS, "as");
//EL
strcpy((char *)conjs + 2*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 2*MAX_LETTERS, "a");
//NOSOTROS
strcpy((char *)conjs + 3*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 3*MAX_LETTERS, "amos");
//VOSOTROS
strcpy((char *)conjs + 4*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 4*MAX_LETTERS, "áis");
//ELLLOS
strcpy((char *)conjs + 5*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 5*MAX_LETTERS, "an");
//Present Progressive
//YO
strcpy((char *)conjs + 6*MAX_LETTERS, "estoy ");
strcpy((char *)conjs + 6+6*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 6+6*MAX_LETTERS, "ando");
//TU
strcpy((char *)conjs + 7*MAX_LETTERS, "estás ");
strcpy((char *)conjs + 6+7*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 6+7*MAX_LETTERS, "ando");
//EL
strcpy((char *)conjs + 8*MAX_LETTERS, "está ");
strcpy((char *)conjs + 5+8*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 5+8*MAX_LETTERS, "ando");
//NOSOTROS
strcpy((char *)conjs + 9*MAX_LETTERS, "estamos ");
strcpy((char *)conjs + 8+9*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 8+9*MAX_LETTERS, "ando");
//VOSOTROS
strcpy((char *)conjs + 10*MAX_LETTERS, "estáis ");
strcpy((char *)conjs + 7+10*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 7+10*MAX_LETTERS, "ando");
//ELLLOS
strcpy((char *)conjs + 11*MAX_LETTERS, "están ");
strcpy((char *)conjs + 6+11*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 6+11*MAX_LETTERS, "ando");
//Preterite
//YO
strcpy((char *)conjs + 12*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 12*MAX_LETTERS, "é");
//TU
strcpy((char *)conjs + 13*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 13*MAX_LETTERS, "aste");
//EL
strcpy((char *)conjs + 14*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 14*MAX_LETTERS, "ó");
//NOSOTROS
strcpy((char *)conjs + 15*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 15*MAX_LETTERS, "amos");
//VOSOTROS
strcpy((char *)conjs + 16*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 16*MAX_LETTERS, "asteis");
//ELLLOS
strcpy((char *)conjs + 17*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 17*MAX_LETTERS, "aron");
}
else if(*p == 'e' || *p == 'i')
{
//Present
//YO
strcpy((char *)conjs, infin);
strcpy((char *)conjs+val, "o");
//TU
strcpy((char *)conjs + MAX_LETTERS, infin);
strcpy((char *)conjs+val + MAX_LETTERS, "es");
//EL
strcpy((char *)conjs + 2*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 2*MAX_LETTERS, "e");
if(*p == 'e')
{
//NOSOTROS
strcpy((char *)conjs + 3*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 3*MAX_LETTERS, "emos");
//VOSOTROS
strcpy((char *)conjs + 4*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 4*MAX_LETTERS, "éis");
}
else
{
//NOSOTROS
strcpy((char *)conjs + 3*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 3*MAX_LETTERS, "imos");
//VOSOTROS
strcpy((char *)conjs + 4*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 4*MAX_LETTERS, "ís");
}
//ELLLOS
strcpy((char *)conjs + 5*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 5*MAX_LETTERS, "en");
//Present Progressive
//YO
strcpy((char *)conjs + 6*MAX_LETTERS, "estoy ");
strcpy((char *)conjs + 6+6*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 6+6*MAX_LETTERS, "iendo");
//TU
strcpy((char *)conjs + 7*MAX_LETTERS, "estás ");
strcpy((char *)conjs + 6+7*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 6+7*MAX_LETTERS, "iendo");
//EL
strcpy((char *)conjs + 8*MAX_LETTERS, "está ");
strcpy((char *)conjs + 5+8*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 5+8*MAX_LETTERS, "iendo");
//NOSOTROS
strcpy((char *)conjs + 9*MAX_LETTERS, "estamos ");
strcpy((char *)conjs + 8+9*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 8+9*MAX_LETTERS, "iendo");
//VOSOTROS
strcpy((char *)conjs + 10*MAX_LETTERS, "estáis ");
strcpy((char *)conjs + 7+10*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 7+10*MAX_LETTERS, "iendo");
//ELLLOS
strcpy((char *)conjs + 11*MAX_LETTERS, "están ");
strcpy((char *)conjs + 6+11*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 6+11*MAX_LETTERS, "iendo");
//Preterite
//YO
strcpy((char *)conjs + 12*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 12*MAX_LETTERS, "í");
//TU
strcpy((char *)conjs + 13*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 13*MAX_LETTERS, "iste");
//EL
strcpy((char *)conjs + 14*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 14*MAX_LETTERS, "ió");
//NOSOTROS
strcpy((char *)conjs + 15*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 15*MAX_LETTERS, "imos");
//VOSOTROS
strcpy((char *)conjs + 16*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 16*MAX_LETTERS, "isteis");
//ELLLOS
strcpy((char *)conjs + 17*MAX_LETTERS, infin);
strcpy((char *)conjs+val + 17*MAX_LETTERS, "ieron");
}
else
return 0;
return strlen((char *)conjs);
}
This is where I apply the function (I've downsized the code a bit):
case IDC_CONJ:
{
char verbInfin[40];
GetDlgItemText(hwnd2, IDC_STEXT, verbInfin,NULL);
char conjugations[MAX_TENSES*MAX_PERSONS][MAX_LETTERS];
char *pTemp;
for(int i = 0; i < MAX_TENSES*MAX_PERSONS; ++i)
{
for(int j = 0; *((char *)conjugations+(i*MAX_LETTERS)+j) != 0; ++j)
{
if(i == 0 && j == 0)
SetDlgItemText(hwnd2,IDC_YOTEXT,((LPCSTR)conjugations+(i*MAX_LETTERS)+j));
}
}
}
break;
Thanks in advance.