problem with read.s string{size}

Just starting out? Need help? Post your questions and find answers here.
gabriel
Enthusiast
Enthusiast
Posts: 137
Joined: Sat Aug 01, 2009 4:49 pm
Location: Beirut, Lebanon

problem with read.s string{size}

Post by gabriel »

Hello:
I've problem with this small program, using data, restore, read seems not working with fixed size strings, why?

Code: Select all

Define str.s{100}, str1.s

Restore label1
Read.s str
Read.s str1
Debug str
Debug str1
End


DataSection
label1:  Data.s  "Hello", "world"
EndDataSection
Thank you
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: problem with read.s string{size}

Post by netmaestro »

You can't do that. Data in datasections must be of a basic native type:
PB Doc for Data keyword wrote:Defines data. The type can only be a native basic type (integer, long, word, byte, ascii, unicode, float, double, quad, character, string).
As a fixedstring cannot reside in the datasection, it can't be read from there either. You could read it into a temporary string var and assign it from there to a fixedstring var.
BERESHEIT
gabriel
Enthusiast
Enthusiast
Posts: 137
Joined: Sat Aug 01, 2009 4:49 pm
Location: Beirut, Lebanon

Re: problem with read.s string{size}

Post by gabriel »

Thank you
Post Reply