Retrieving the Next File

Sometimes you can take advantage of the fact that fgi_filesize() leaves the file pointer positioned at the beginning of the requested file in the FGI library. For instance, the call to fgi_read() in example FGIW4 searches the FGI file indexes for CLOUDS.PCX, even though the file pointer was already positioned right before that image. You can use fgi_readnext() immediately after calling fgi_filesize() to retrieve the "next" file from the same FGI library. This may reduce the number of disk accesses required to retrieve the file and can be especially noticeable when searching large libraries on diskettes or slower CD drives.

The fgi_readnext() function's first parameter is the buffer that will receive the file contents, and the second parameter is the number of bytes to read. Like fgi_read(), the third parameter is the FGI library file handle. For instance, we could replace the fgi_read() call in example FGIW4 with the fgi_readnext() calls shown here:

C/C++:

fgi_readnext(Buffer,BuffSize,hFGI);

Delphi:

fgi_readnext(Buffer^,BufSize,hFGI);

Visual Basic:

Call fgi_readnext(Buffer(0), BuffSize, hFGI)

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.