Inserting a small text in between a string.
#1

Hey,

I m fetching inputtext to another variable.After 79th position i wanna insert ~n~ and then the rest goes.

Can anyone help pls.
Reply
#2

pawn Код:
if(strlen(othervariable) >= 79) strins(othervariable, "~n~", 79, sizeof(othervariable));
Reply
#3

@up - you meant strlen, not strval.
Reply
#4

Код:
C:\Users\newpwn.pwn(28794) : warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")
On the same line.
pawn Код:
if(strlen(inputtext) >= 79) strins(inputtext, "~n~", 79);
Reply
#5

@Misiur - Yeah, you are right, thanks for correcting
Reply
#6

fixed thanks repped
Reply
#7

Sizeof inputtext is just a reference and compiler doesn't know what's its real size. Try

pawn Код:
if(strlen(inputtext) >= 79) strins(inputtext, "~n~", 79, 128);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)