GopherGetNextItem
BOOL GopherGetNextItem(
HCLIENT hClient,  
LPGOPHERITEM lpItem  
);

The GopherGetNextItem function returns the next item in the currently selected directory.

Parameters

hClient
Handle to the client session.
lpItem
A pointer to a GOPHERITEM structure which will contain information about the next item in the currently selected directory.

Return Value

If the function succeeds, the return value is non-zero. If there is no more items in the current index, or the function fails, the return value is zero. To get extended error information, call GopherGetLastError.

Remarks

The GopherGetNextItem function returns the next item in the currently selected directory. This function is used in conjunction with the GopherGetFirstItem function to enumerate all of the items in the directory returned by the server. Typically this is used to provide the user with a list of resources or services to access, or to select subdirectories which list additional items.

Example

HCLIENT hClient;
GOPHERITEM gopherItem;
BOOL bResult;
INT nResult;

// Connect to the Gopher server on the default port
hClient = GopherConnect(lpszHostName,
                        GOPHER_PORT_DEFAULT,
                        GOPHER_TIMEOUT,
                        0);

if (hClient == INVALID_CLIENT)
{
    TCHAR szError[ASTRING];
    DWORD dwError = GopherGetLastError();
    GopherGetErrorString(dwError, szError, ASTRING);
    fprintf(stderr, "Error %08x: %s\n", dwError, szError);
    return;
}

// Select the default root directory
nResult = GopherSelectItem(hClient,
                           GOPHER_ITEM_DIRECTORY,
                           GOPHER_ROOT_SELECTOR);

if (nResult == GOPHER_ERROR)
{
    TCHAR szError[ASTRING];
    DWORD dwError = GopherGetLastError();
    GopherGetErrorString(dwError, szError, ASTRING);
    fprintf(stderr, "Error %08x: %s\n", dwError, szError);
    return;
}

// Get the items in the selected index, printing the selector
// and a description of the item
bResult = GopherGetNextItem(hClient, &gopherItem);
while (bResult)
{
    printf("%s %s\n", gopherItem.szSelector, gopherItem.szDescription);
    bResult = GopherGetNextItem(hClient, &gopherItem);
}

GopherDisconnect(hClient);

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csgprav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

GopherGetFirstItem, GopherSelectItem


Copyright © 2008 Catalyst Development Corporation. All rights reserved.