You will have to elaborate, a little about why that doesn't work. I would do almost exactly the same as you, (although Microsoft might prefer you to use unicode for example, and CStrings if you are in MFC). Watch that if you add a character to the end of a string , that you make the subsequent character a zero, to terminate it, and dont write beyond the end of the array. If you rewrite the string you will have to reset the counter too.<br>
<br>
static int counter;<br>
<br>
void addChar (char newAscii)<br>
{<br>
if (counter==MAX_LEN)<br>
return; // run out of space<br>
string[counter] = newAscii;<br>
string[counter+1] = '\0';<br>
counter++;<br>
}<br>
<br>
//then in the main loop<br>
<br>
//...<br>
char string [MAX_LEN+1]; // extra 1 for terminate<br>
counter = 0;<br>
addChar('h'); // or get from dinput<br>
addChar('e');<br>
printf("%s", string);<br>
printf("String is %ld long", counter);<br>
//...<br>
<br>
I hope this tackles your problem, if not please elaborate<br>