Hi;

i am having problem with this simple line of code.
im getting char value at WM_CHAR and inputing it in array

ptext[300] and use textout to output on the screen but i get this

random unwanted spaces in between characters at times on the output screen what am i doing wrong


Code:
ptext[300]

static int  cxchar, cychar, i = 0, x = 0, cxclient, cyclient, j = 0;

WM_CREATE:
////////////////////

GetTextMetric(,,,,,,,,,,,,,,,,,,,,,,)
cxchar = ,,,,,,,,,,
cychar = ,,,,,,,,,,

///////////////////

WM_CHAR:

ptext[x] = (char)wParam;
x++;
TextOut(hdc, i * cxchar, j, ptext + x, 1);
i++;
if((char)wParam == '\r'){
j++;
i = 0;
}
the characters as i type them appear as follow;


ffffj kn o sssssl e

i can do it another way by simply using

TextOut(hdc, 0, j, ptext, x);
and getting read of i .

and it works but i need i somewhere down the code and i want to use the first case .

thx