why did they make chars so hard to use? first it has to be constant, or a pointer, then there are terminating NULLs, differing quotes, arrgggggh!!!
im making my own input routine, and everything is working except when 12 or more characters are entered. then when the final value is printed out at the end, it displays a version of the string where some of the characters are missing. eg, if you enter "01234567890", it displays the same, but "012345678901" returns an empty string! anything above 12 starts displaying weird strings, containing the correct characters but all messed up.
here is some code:
that is the temp string where the inputed characters are added one by one, and another temp string to take the getch().Code:char *temp; char *temp1; temp1=""; temp="";
that code is for when a character is valid and is to be displayed and added to the temp string.Code:temp1=getch(); if (key is not an 'enter' or similar) dispText(temp1,font,sx,sy); //this routine just displays text temp[len]=k; //len is current string length len++; //increment len temp[len]=0; // set terminator sx+=6; //graphics stuff; break;
im not sure but i think that its in that last bit of code where the error is. is there some rule of strings where you can only have 12 characters or something?