my problem is passing a string pointer to a function
here is what i want to do,
assign a variable string so many x spaces prior to calling function
call a function
have the function work on the string using the pointer
return from the function
as shown below, the method i have now is slow, probably has something to do with the stack, i do not know
i would perfer to work on the string in the function without having to create a variable byte ptr using strptr(temp$)
i am not sure if calling the function with a pointer instead of using byref but i feel it would be faster
another question
if i pass a string as a pointer, can i easily get the length of the string inside the function, this would keep me from having to passing the length of the string at the call to the function
i want something like this, if it would help speed thing up, i am sure my codeing will not be right calling the function, that is where i need help
thanks
paul
here is what i want to do,
assign a variable string so many x spaces prior to calling function
call a function
have the function work on the string using the pointer
return from the function
as shown below, the method i have now is slow, probably has something to do with the stack, i do not know
Code:
the function: functiona(byref temp$ as string) local i as long local ptrtemp as byte ptr ptrtemp=strptr(temp$) for i=0 to len(temp$)-1 poke byte,ptrtemp+i,asc("%") next i end function the code in main program: temp$=space$(25) functiona(temp$)
i am not sure if calling the function with a pointer instead of using byref but i feel it would be faster
another question
if i pass a string as a pointer, can i easily get the length of the string inside the function, this would keep me from having to passing the length of the string at the call to the function
i want something like this, if it would help speed thing up, i am sure my codeing will not be right calling the function, that is where i need help
Code:
the function: functionb(byref ptrtemp as pointer) local i as long local j as long j=len(ptrtemp) for i=0 to j-1 poke byte,ptrtemp+i,asc("%") next i end function the code in the main program: temp$=space$(25) functionb(strptr(temp$))
paul
Comment