Hi, I have this string "line1\nline2\nline3\n", that I would like to print out with TextOut(), but since TextOut() doesn't support '\n', I had to make it myself.
And It does print "line1" and under it "line2", but that's it, why?
Where is "line3"?
"line1\nline2\nline3\n" is been passed inside msg
Code:
void preview_text(HDC hDC, int x, int y, char *msg)
{
int i, j=0;
char line[100]={0};
for (i=0; i<strlen(msg); ++i)
{
if (msg[i]=='\n')
{
TextOut(hDC, x, y, line, strlen(line));
memset(line, '\0', 100);
y += 13;
j = 0;
}
else
line[j++] = msg[i];
}
}
Thanks.