|
3 registered members (AndrewAMD, SBGuy, Petra),
801
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: inkey and key 'end' memory error
[Re: Reconnoiter]
#456558
11/28/15 14:28
11/28/15 14:28
|
Malice
Unregistered
|
Malice
Unregistered
|
Yes indeed, inkey is limited to the size of the string. If you change the sting size you clip inkey. But even more copying the textbox->characters into the input is pointless, as inkey, should start at the first character location and overwrite the whole string.
|
|
|
Re: inkey and key 'end' memory error
[Re: ]
#456559
11/28/15 15:11
11/28/15 15:11
|
Malice
Unregistered
|
Malice
Unregistered
|
STRING* str_input;
STRING* str_temp;
STRING* str_flush_buffer="#100";
STRING* str_textbox[10];
function fill_textboxs()
{
int I;
for(I=0;i<10;i++)
{
str_textbox[I]=str_create("");
}
}
function str_mod()
{
int int_str_len;
str_cpy(str_input,str_flush_buffer); // Clear the input
int_str_len=str_len(str_textbox[0]); // Find current len of textbox
str_cpy(str_temp,str_textbox[0]); // move textbox into temp/ or use a textbox_dply[array size of textbox]
str_cat(str_temp,str_flush_buffer); // add the maximun input len of white spaces
str_trunc(str_temp,int_str_len); // cut textbox len of white spaces off end of temp
str_cpy(str_input,str_temp); // fill the input text + white_space trunced to max
inkey(str_input); // Edit text
str_cpy(str_textbox[0],str_input); // replace text in texbox
int_str_len=str_len(str_textbox[0]); // degubbing only
}
Not sure how this works but it's an idea to work from Mal
|
|
|
Re: inkey and key 'end' memory error
[Re: ]
#456621
12/01/15 13:19
12/01/15 13:19
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
lol, I think I found a really funny solution with your help Malice, doing this after having copied content of current textbox string and before doing inkey(...):
str_cat(input_str, str_flush_buffer); //add spaces
str_trunc(input_str, 1); //removes point of memory error
I am not sure if this is bulletproof though. I mean in the world of memory errors it would be best to not use it blindly. So far after some testing it seems good though.
|
|
|
Re: inkey and key 'end' memory error
[Re: Reconnoiter]
#456626
12/01/15 17:24
12/01/15 17:24
|
Malice
Unregistered
|
Malice
Unregistered
|
LOl - That's how it works with my help more often then not. I spit fire blind ideas and smart people find something useful in it. It is a odd solution, I'd love to hear jcl explain why it works and throws a error without.
Mal
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|
|
|