How to print a list of strings to a file in a table format?
<p>i have an array in a fixed size:
    <code>library[BOOKNUM]</code></p>

<p>each item in the array is a <code>struct book</code>.</p>

<p><strong>Struct Book</strong></p>

<pre><code>typedef struct _book{

    char name[NAME_LENGTH];
    char authors[AUTHORS_NAME_LENGTH];
    char publisher[PUBLISHER_NAME_LENGTH];
    char genre[GENRE_LENGTH];
    int year;
    int num_pages;
    int copies;
}book;
</code></pre>

<p>My goal is to print a list of files like this:</p>

<pre><code>Name                    Author                Publisher                     Genre ...
War and Remembrance     Herman Wouk           Good Books Publishing, LtD    Historic Novel 
Zzz, from A to Z        Noam Chomsky          Bad Books Publishing, LtD     Linguistics
Splitting the Atom      Margaret Openheimer   Science Books Publishing, inc Nuclear Physics
</code></pre>

<p>and so on for all the books and all the attributes.</p>

<p>I tried putting <code>\t</code> between attribute, didn't work.</p>

<p>I tried printing between each attribute (30-len(attribute))* spaces, didn't work.</p>

<p>Does anyone have suggestions?</p>