Strptr.o2bas

Started by Frank Brübach, December 02, 2024, 07:33:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Frank Brübach

Hello ... Found this little Error.. in strptr.o2bas example..

zstring * tz' doesn't Work

Must be zstring tz


' demos/Basics/strptr.o2bas
' correction
'
string  sa="Hello String"
bstring sb="Hello Bstring"
zstring sz[]="Hello Zstring"

'zstring * tz="Hello LpSzString" ' doesnt work
zstring tz="Hello LpSzString"

wstring  wsa="Hello Wide String"
wbstring wsb="Hello Wide Bstring"
wzstring wsz[]="Hello Wide Zstring"

'GET THE POINTERS FOR EACH STRING TYPE
sys psa,psb,psz,psi,psl,wpsa,wpsb,wpsz
psa=strptr sa
psb=strptr sb
psz=strptr sz
psi=strptr tz
psl=strptr "Hello literal String"

wpsa=strptr wsa
wpsb=strptr wsb
wpsz=strptr wsz

string pr,cr

cr=chr(13)+chr(10)

'USE CASTING TO DISPLAY AS ZSTRINGS:

pr=
  cast zstring *psa + cr +
  cast zstring *psb + cr +
  cast zstring *psz + cr +
  cast zstring *psi + cr +
  cast zstring *psl + cr +
  cr +
  cast wzstring *wpsa + cr +
  cast wzstring *wpsb + cr +
  cast wzstring *wpsz + cr +
  cr

print pr

The using of cast zstring * PSA for example does Work only with zstring and wzstring? Here you can use IT Else?

Charles Pegge

The string pointers for each initialized string type:

string:  *s
bstring: ?s
zstring: @s
literal strings: ?s
byval] string arguments: ?s

I use strptr() to abstract away these differences and avoid the necessity of low-level coding.