Computer Science Canada Max string size |
Author: | Mephi [ Sun Apr 27, 2003 2:50 pm ] |
Post subject: | Max string size |
how do you make it so that if a person puts in more than 256 characters or whatever the limit is it doesn't crash? can you make it so theres no limit? |
Author: | Asok [ Sun Apr 27, 2003 2:52 pm ] | ||
Post subject: | |||
this for example will only get the first 6 characters in the string |
Author: | nate [ Sun Apr 27, 2003 2:56 pm ] |
Post subject: | this is how i do it |
var text : string (20) get text : 20 put text This limits both the variable and the text you can enter. Right now it is 20 but you can change it to the 250 limit -Nate |
Author: | Mephi [ Sun Apr 27, 2003 3:01 pm ] |
Post subject: | Umm... |
hey nate:P (to both) they dont work.....if you put in a number larger than 255 its an error |
Author: | Asok [ Sun Apr 27, 2003 3:09 pm ] |
Post subject: | |
mephi, are you trying to exceed the 255 cap or make it so that the user doesn't enter into the 255 cap? |
Author: | Mephi [ Sun Apr 27, 2003 3:10 pm ] |
Post subject: | both |
well exceed mainly, but i guess just limiting is ok too....thx....as long as it duznt crash (my comp teachers really stingy, he keeps tryin to crash our programs ne way possible) |
Author: | Mephi [ Sun Apr 27, 2003 3:27 pm ] | ||
Post subject: | erm.. | ||
how come if its less than 8 the ! goes on a different line? or is this just me? |
Author: | Tony [ Sun Apr 27, 2003 3:28 pm ] | ||
Post subject: | |||
I belive this issue was already addressed by the use of getch() in a loop
|
Author: | Mephi [ Sun Apr 27, 2003 3:38 pm ] | ||
Post subject: | nvm | ||
nvm i found an easier way:
just takes first 8 characters |
Author: | Tony [ Sun Apr 27, 2003 3:42 pm ] |
Post subject: | |
well you can still type in 300 characters and your program will crash. Using getch will read input 1 key at a time, safeguarding your string variable |
Author: | jamez [ Thu May 01, 2003 9:14 am ] | ||
Post subject: | Re: nvm | ||
Mephi wrote: nvm i found an easier way:
just takes first 8 characters have 'get x' allows the user to input 1000s of characters |