C++ builder 6 help needed
Can anybody help with this problem i have with bcb ver6.
I have a simple program, with an array of strings. There are 100 words in this array. the array is in a function called get_a_word. Then in the T Form object i have a char word[20]. I randomly select a word and copy it into the both the hidden_word and words strings. T
This works fine once, but once i call the function again if the previous word was longer than the one now selected the program, leaves the remaining characters in place e.g. first word = Hello, second word = Hi , whats in string = Hillo.
I have tried using the strcpy(words,"") to clear the string first, but it doesnt seem to clear correctly. I am calling this from the get_a_word function. Sample of code below.
Can anybody help me?
Att
//code for program //
TForm1 *Form1;
char words[20];
char hidden_word[20];
//-------------------------------
TForm1::get_a_word()
{
int size, x, y;
char wordlist[20][20]=
{
//word list here
};
strcpy(word,"");
strcpy(hidden,"");
}