Structures

Just starting out? Need help? Post your questions and find answers here.
twobits
User
User
Posts: 11
Joined: Thu May 22, 2003 6:53 pm

Structures

Post by twobits »

Hi,
Is it possible to declare a string within a structure to be a certain number of bytes long?
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

No, but you could declare a fixed array of bytes and PokeS()/ PeekS() the string in and out.
FloHimself
Enthusiast
Enthusiast
Posts: 229
Joined: Wed May 14, 2003 3:38 pm
Location: Lüneburg - Germany

Post by FloHimself »

like this:

Code: Select all

Structure your_struct
  stringvar.b[15]
EndStructure

foo.your_struct

PokeS(@foo\stringvar[0], "foo")
Debug PeekS(@foo\stringvar[0])
twobits
User
User
Posts: 11
Joined: Thu May 22, 2003 6:53 pm

Post by twobits »

Thanks a lot mate :)
That c;ears up quite a lot of confusion I had :)
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

8O thanks a lot, that remove a for next loop.

:oops:
Post Reply