Passing const char* c->zbasic
Posted: 10 January 2009, 2:19 AM
Hi Iḿ trying to write the following sub... which is called from some c code and intended to pass a const char* into zbasic. Am I heading in the write direction ? Not sure if Ive got the if check for str termination correct or if the subroutine parameter declaration is ok. Im not able to test it yet to determine if it works, although Im sure I am missing something
Thanks
Neil
Code: Select all
'~ To be called from the Menu_imp.c which needs to pass
'~ a const char* to this zbasic subroutine
'~ The generated c function should have prototype (void)(const char*)
public sub DisplayStr_C(byval strPtr as UnsignedInteger)
Dim d() as Byte Based strPtr
Dim str as String = ""
Dim i as byte = 0
do
if (d(i) = 0) then
exit do
end if
str = str & d(i)
i = i + 1
loop
call DisplayStr(str)
end sub
Neil