GopherCreateLocatorA function (wininet.h)

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

Creates a Gopher or Gopher+ locator string from the selector string's component parts.


BOOL GopherCreateLocatorA(
  [in]      LPCSTR        lpszHost,
  [in]      INTERNET_PORT nServerPort,
  [in]      LPCSTR        lpszDisplayString,
  [in]      LPCSTR        lpszSelectorString,
  [in]      DWORD         dwGopherType,
  [out]     LPSTR         lpszLocator,
  [in, out] LPDWORD       lpdwBufferLength


[in] lpszHost

Pointer to a null-terminated string that contains the name of the host, or a dotted-decimal IP address (such as

[in] nServerPort

Port number on which the Gopher server at lpszHost lives, in host byte order. If nServerPort is INTERNET_INVALID_PORT_NUMBER, the default Gopher port is used.

[in] lpszDisplayString

Pointer to a null-terminated string that contains the Gopher document or directory to be displayed. If this parameter is NULL, the function returns the default directory for the Gopher server.

[in] lpszSelectorString

Pointer to the selector string to send to the Gopher server in order to retrieve information. This parameter can be NULL.

[in] dwGopherType

Determines whether lpszSelectorString refers to a directory or document, and whether the request is Gopher+ or Gopher. The default value, GOPHER_TYPE_DIRECTORY, is used if the value of dwGopherType is zero. This can be one of the gopher type values.

[out] lpszLocator

Pointer to a buffer that receives the locator string. If lpszLocator is NULL, lpdwBufferLength receives the necessary buffer length, but the function performs no other processing.

[in, out] lpdwBufferLength

Pointer to a variable that contains the length of the lpszLocator buffer, in characters. When the function returns, this parameter receives the number of characters written to the buffer. If GetLastError returns ERROR_INSUFFICIENT_BUFFER, this parameter receives the number of characters required.

Return value

Returns TRUE if successful, or FALSE otherwise. To get extended error information, call GetLastError or InternetGetLastResponseInfo.


To retrieve information from a Gopher server, an application must first get a Gopher "locator" from the Gopher server.

The locator, which the application should treat as an opaque token, is normally used for calls to the GopherFindFirstFile function to retrieve a specific piece of information.

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).


The wininet.h header defines GopherCreateLocator as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wininet.h
Library Wininet.lib
DLL Wininet.dll

See also

WinINet Functions