Reply To: SMAT Reader

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library SMAT Reader Reply To: SMAT Reader

#56490
Charlie Bursell
Participant

Just a tip.  There are many unique and useful utilities that you can write that use the SMAT files.  You just need to be aware of the format of the files.

The .idx file contains lists of keyed lists.  Therefore it can best be read using the lgets command.  The lgets command will read a whole list at a time.  Since the list is just one element, to access it as a keyed list, simply remove it from the list context.  For example, consider a SMAT file with name of foo.idx:

set fd [open foo.idx]     ;# Default mode is read only

while {[lgets $fd klist] >= 0}  {

     set klist [lindex $klist 0]    ;# Remove from list format

     echo [keylkeys klist]

     # Add you own code here

}

The echo would yield:

MID SRCMID TYPE SOURCECONN ORIGSOURCECONN DESTCONN ORIGDESTCONN TIME PRIORITY DATAFMT SAVECONTEXT OFFSET LENGTH

For example to read the associated .msg file, just move to [keylget klist OFFSET] and read [keylget klist LENGTH] bytes.

You can get any other data you want from the .idx file by using keyed list commands.  You could also set up searches, etc.  Its left to your own needs and imagination.  After all that’s why you get paid the big bucks  ðŸ˜›

Hope this helps

Charlie

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10