sigh... why dosent this work?
After trying for 20 minutes with every possible way I could think of, I have come to seek expert advice lol....
What I'm trying to do with the code below is have a array of 100 strings (lines[100]), and with this, I want to periodicly add a new string to it, and bump out the oldest array off. (ex. lines[0] becomes lines[1]... lines[100] gets bumped off) If we run out of room. So in order to do that, I've created two for () {... statements... the first one copies the array to a templines array.. then the next one trys to move all arrays up one, leaving lines[0] for me to put the new data in... and lines[100] gets deleted. Now, when I try to run the code below in my program, I get an error and Borland C++ 3.1 closes with an error. Am I doing somthing wrong? Or, how would you do this? I have declared the char *lines[100]; in the begenning of the program....
// linecount = the current line the array is used up to
if (lineCount >= 100) {
char *templines[100];
for (int i = 0; i <= 99; i++) {
strcpy(templines[i], lines[i]);
templines[i] = newStr( lines[i] );
}
for (int i = 0; i <= 99; i++) {
strcpy(lines[i + 1],templines[i]);
}
strcpy(lines[0], "HI JON!\n");
} else {
lineCount++;
strcpy(lines[lineCount], "HI JON!\n");
}
Thank you!
Jon Scott
lol.... I have no clue how to do that
lol, well, thanks for the advice but I have no clue how to go about that... I'm not new to the programming scene, but to c++ I am ! lol, is there a example you could show me?
Thanks for you help!
Jon Scott