Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Offhand, the simplest way to do it is to write the structure out sequentially so that:</p> <pre><code>[trex item #1] [list item #1] [list item #2] [list item #3] [trex item #2] [list item #1] [list item #2] [list item #3] [list item #4] etc... </code></pre> <p>(Of course, this is just sort of the jist of it. These are binary writes and this is a visual only.)</p> <p>I'm hoping that <code>fn_len</code> describes the number of items in the linked list <code>struct list *filenames</code>. If so, this is a snap.</p> <p>On writing:</p> <ol> <li>Write out the first structure in the <code>trex</code> linked list</li> <li>Loop and write out the <code>struct list *filenames</code> from that first <code>trex</code> structure one at a time</li> <li>Repeat #1 with the next item in the <code>trex</code> linked list until the list is exhausted.</li> </ol> <p>On reading, remember: <em>all of your pointers are going to be worthless initially</em>. You have to stitch them together yourself. But the structures are arranged in the correct order in the file.</p> <ol> <li>Read the first <code>trex</code> structure. You know its size, reading it isn't a problem. Fix the <code>next</code> pointer to nothing.</li> <li>Loop and read each of the <code>struct list *filenames</code> one at a time. You know how many they are because of <code>fn_len</code> in the structure you just read. Stitch together that linked list and attach it to the trex structure.</li> <li>Repeat #1 with the next <code>trex</code> structure until EOF, join the structure onto the end of the linked list as appropriate.</li> </ol> <p>And that should take care of it. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload