[Gambas-user] File Format Help

John Dovey dovey.john at gmail.com
Thu Jun 17 16:46:51 CEST 2021


I hope no-one minds if I ask this here. I'm just really unsure how to do
this best in Gambas.
I want to read and write files that have a (very old) specification
<http://ftsc.org/docs/fts-0001.016>
Essentially, it looks like this:

 1. Application Layer Data Definition : a Stored Message

                               Stored Message

       Offset
      dec hex
              .-----------------------------------------------.
        0   0 |                                               |
              ~                 fromUserName                  ~
              |                   36 bytes                    |
              +-----------------------+-----------------------+
       36  24 |                                               |
              ~                  toUserName                   ~
              |                   36 bytes                    |
              +-----------------------+-----------------------+
       72  48 |                                               |
              ~                    subject                    ~
              |                   72  bytes                   |
              +-----------------------+-----------------------+
      144  90 |                                               |
              ~                    DateTime                   ~
              |                    20 bytes                   |
              +-----------------------+-----------------------+
      164  A4 | timesRead (low order) | timesRead (high order)|
              +-----------------------+-----------------------+
      166  A6 | destNode (low order)  | destNode (high order) |
              +-----------------------+-----------------------+
      168  A8 | origNode (low order)  | origNode (high order) |
              +-----------------------+-----------------------+
      170  AA |   cost (low order)    |   cost (high order)   |
              +-----------------------+-----------------------+
      172  AC | origNet (low order)   | origNet (high order)  |
              +-----------------------+-----------------------+
      174  AE | destNet (low order)   | destNet (high order)  |
              +-----------------------+-----------------------+
      176  B0 | destZone (optional)   | destZone (optional)   |
              +-----------------------+-----------------------+
      178  B2 | origZone (optional)   | origZone (optional)   |
              +-----------------------+-----------------------+
      180  B4 | destPoint(optional)   | destPoint(optional)   |
              +-----------------------+-----------------------+
      182  B6 | origPoint(optional)   | origPoint(optional)   |
              +-----------------------+-----------------------+
      184  B8 |  replyTo (low order)  |  replyTo (high order) |
              +-----------------------+-----------------------+
      186  BA | Attribute (low order) | Attribute (high order)|
              +-----------------------+-----------------------+
      188  BC | nextReply (low order) | nextReply (high order)|
              +-----------------------+-----------------------+
      190  BE |                      text                     |
              ~                    unbounded                  ~
              |                 null terminated               |
              `-----------------------------------------------'

      Message    = fromUserName(36)  (* Null terminated *)
                   toUserName(36)    (* Null terminated *)
                   subject(72)       (* see FileList below *)
                   DateTime          (* message body was last edited *)
                   timesRead         (* number of times msg has been read *)
                   destNode          (* of message *)
                   origNode          (* of message *)
                   cost              (* in lowest unit of originator's
                                        currency *)
                   origNet           (* of message *)
                   destNet           (* of message *)
                   destZone          (* of message *)
                   origZone          (* of message *)
                   destPoint         (* of message *)
                   origPoint         (* of message *)
                   replyTo           (* msg to which this replies *)
                   AttributeWord
                   nextReply         (* msg which replies to this *)
                   text(unbounded)   (* Null terminated *)

There is a sample packet
<https://www.dan.info/sampledata/BAD_BNDL.007> you can look at if you
really want to see what it looks like, but this should give you an
idea:

[image: image.png]


I'm guessing a "Struct" of some sort?

Any advice would be appreciated.


John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210617/d0b54567/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 41649 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210617/d0b54567/attachment-0001.png>


More information about the User mailing list