'strings' are simply arrays of bytes. the print command can tell it's hit the end of a string when it gets to a null terminator, ie, '/0' or more simply, the value 0. Since you don't load this, it will keep reading onward until it eventually hits one. (you cannot tell how long an array is simply by a pointer, which is why this logic applies here)
because you defined the two arrays like so:
char ch[40];
char se_corner[40];
they are placed in memory one after the other.
the values in memory after them are likly zero, so when printing from ch[0], it will continue on till just after of se_corner where it will find the first 0.
hence it doesn't mean your arrays are buggered,
to fix the printing when you want to, simply make a copy of the array, but make it 1 longer and set the last value to 0, or '/0' if you prefer, something like:
void tools::printArray(char * array, int length){ char * textBlock = new char[length+1]; textBlock[length]='/0'; memcpy(textBlock,array,length); printf(textBlock); delete [] textBlock;}
| - Project-X - my mega project.. big things comming soon - | - adDeath - an ad blocker I made - | - email me - | [edited by - RipTorn on January 10, 2003 8:56:47 AM]