Type question

Started by Frank Brübach, May 30, 2024, 03:24:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Frank Brübach

Hello Charles,

Can I add a value and a String with a Type in a function?

type aStruct
    a as long
    b as zstring
end type

function one_add(long a,b) as long
dim st as aStruct

st.a = 5
st.b = "Thor"
return a+b

end function

function two_add(long a,b) as long
dim st as aStruct

st.a = 5
st.b = "Thor"
return st.a+str(st.b)

end function

print "one_add: " + one_add(2,4) ' result 6
print "two_add: " + two_add(2,4) ' result 50 ' ???


Charles Pegge

Hi Frank,

I could not make sense of your example but in any case, you will need to specify the allocated char count of the zstring

type aStruct
    a as long
    b[16] as zstring
end type