IT-Consultant: Charles Pegge > OxygenBasic Examples

byte pointers how ?

(1/2) > >>

Zlatko Vid:
Hello Charles

i know that you show me once something similar
but i simply forget how...

my question is how to use

]byte b as strptr(s)
byte b1 as strptr(s1)

and how connect this two strings into one ?

here is my try :

--- Code: ---'pointer with byte type ...
string s1="Aurel", s3= "_microA"

byte b At strptr s1
byte b1 At strptr s3

bp = b+b1

ps = @bp

'p = @ps

print ps
--- End code ---

Charles Pegge:
Hi Aurel,

You will need to add your strings first. Then you have byte access to the whole string.


--- Code: ---'pointer with byte type ...
string s1="Aurel", s2= "_microA"
string s3=s1+s2

byte b[] at strptr s3 'array of ascii bytes

--- End code ---

Zlatko Vid:
ahh  i see array of ascii bytes.... i get it
thanks Charles

 in this case  is also same :


--- Code: ---'string pointer
string s = "viva" ,s2 = " LasVegas",ps
'concat two strings
ps = s+s2
int p As string ptr
' p hold addres of ps
p = @ps

'print
print p
--- End code ---

yes i see it now ...ok  :)
 

Zlatko Vid:
hmm but how print content of that
array of ascii bytes ?

Charles Pegge:
If you don't want to refer to the original string, it is possible to turn the array of bytes back into a string for printing etc.
But both the byte array and the new string are directly coupled to the original string.


--- Code: ---...
byte b[] at strptr s3 'array of ascii bytes
print b[3]
'
'now reference b as a string again
bstring bs
strptr(bs)=@b
print bs

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version