Oxygen Basic
Programming => Problems & Solutions => Topic started by: Aurel on August 04, 2013, 11:48:13 AM
-
Charles
Do you can show us why this PowerBasic code in oxygen not work,
it complain about static type,or i translate in a wrong way ???
FUNCTION StringOfStrings() AS STRING
static STRING s
s=STRING(1024*4,CHR(0))
DIM ss(1023) AS STATIC STRING AT STRPTR(s)
ss(16)="Hello"
FUNCTION=s
END FUNCTION
FUNCTION pbf () AS LONG
DIM s AS STATIC STRING
DIM t AS STRING
s=StringOfStrings()
t=s 'tranferanferability test
DIM ss(1023) AS STRING AT STRPTR(t)
ss(16)+=" World!"
print ss(16)
END FUNCTION
Example is your from JoseRoca forum...
-
Hi Aurel,
It is not interpreting the 'at strptr(s) PB' style syntax as expected
If you like using dim statements, I would do it this way:
function StringOfStrings() as string
static as string s=nuls 1024*sizeof string
dim as string ss at (strptr s)
ss(16)="Hello" 'test
return s
end function
function pbf () as sys
static as string s,t
s=StringOfStrings()
t=s 'transferability test
dim as string ss(1023) AT (STRPTR t)
ss(16)+=" World!"
print ss(16)
end function
pbf