Collapse the table of content
Expand the table of content

GopherOpenFile function

[The GopherOpenFile function is available for use in the operating systems specified in the Requirements section.]

Begins reading a Gopher data file from a Gopher server.


HINTERNET GopherOpenFile(
  _In_ HINTERNET hConnect,
  _In_ LPCTSTR   lpszLocator,
  _In_ LPCTSTR   lpszView,
  _In_ DWORD     dwFlags,
  _In_ DWORD_PTR dwContext


hConnect [in]

Handle to a Gopher session returned by InternetConnect.

lpszLocator [in]

Pointer to a null-terminated string that specifies the file to be opened. Generally, this locator is returned from a call to GopherFindFirstFile or InternetFindNextFile. Because the Gopher protocol has no concept of a current directory, the locator is always fully qualified.

lpszView [in]

Pointer to a null-terminated string that describes the view to open if several views of the file exist on the server. If lpszView is NULL, the function uses the default file view.

dwFlags [in]

Conditions under which subsequent transfers occur. This parameter can be any of the following values.


Forces a reload if there was no Expires time and no LastModified time returned from the server when determining whether to reload the item from the network.


Causes a temporary file to be created if the file cannot be cached.


Does not add the returned entity to the cache.


Forces a download of the requested file, object, or directory listing from the origin server, not from the cache.


Reloads HTTP resources if the resource has been modified since the last time it was downloaded. All FTP and Gopher resources are reloaded.


dwContext [in]

Pointer to a variable that contains an application-defined value that associates this operation with any application data.

Return value

Returns a handle if successful, or NULL if the file cannot be opened. To retrieve extended error information, call GetLastError or InternetGetLastResponseInfo.


GopherOpenFile opens a file at a Gopher server. Because a file cannot actually be opened or locked at a server, this function simply associates location information with a handle that an application can use for file-based operations such as InternetReadFile or GopherGetAttribute.

After the calling application has finished using the HINTERNET handle returned by GopherOpenFile, it must be closed using the InternetCloseHandle function.

Like all other aspects of the WinINet API, this function cannot be safely called from within DllMain or the constructors and destructors of global objects.

Note  WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).


Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

End of client support

Windows XP

End of server support

Windows Server 2003 R2







Unicode and ANSI names

GopherOpenFileW (Unicode) and GopherOpenFileA (ANSI)

See also

WinINet Functions



© 2015 Microsoft