File: ex_read.c

package info (click to toggle)
e00compr 1.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 272 kB
  • ctags: 238
  • sloc: ansic: 1,316; makefile: 69
file content (43 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**********************************************************************
 *                          ex_read.c
 *
 * This example program illustrates the use of the E00ReadOpen()
 * and associated compressed E00 read functions.
 **********************************************************************/

#include <stdio.h>

#include "e00compr.h"

int main(int argc, char *argv[])
{
    E00ReadPtr  hReadPtr;
    const char  *pszLine;

    /* Open input */
    hReadPtr = E00ReadOpen("test.e00");

    if (hReadPtr)
    {
        /* Read lines from input until we reach EOF */
        while((pszLine = E00ReadNextLine(hReadPtr)) != NULL)
        {
            if (E00GetLastErrorNo() == 0)
                printf("%s\n", pszLine);
            else
            {
                /* An error happened while reading the last line... */
                break;
            }
        }

        /* Close input file */
        E00ReadClose(hReadPtr);
    }
    else
    {
        /* ERROR ... failed to open input file */
    }

    return 0;
}