---
name: "gd_verbose_prefix"
section: "3"
platform: "linux"
package: "libgetdata-doc"
version: "0.11.0-15"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/gd_verbose_prefix"
---

# gd\_verbose\_prefix(3)

set the prefix on error messages printed by GetData

## NAME

gd\_verbose\_prefix — set the prefix on error messages printed by GetData

## SYNOPSIS

**#include \<getdata.h\>**

**int gd\_verbose\_prefix(DIRFILE \****dirfile***, const char \****prefix***);**

## DESCRIPTION

The **gd\_verbose\_prefix**() sets the prefix printed before error messages output by the GetData library for the [dirfile(5)](/dirfile/5.md) database specified by *dirfile*. If *prefix* is NULL, the current prefix (if any) is deleted and no new prefix is saved.

GetData only prints error messages for a given Dirfile if opened along with the **GD\_VERBOSE** flag, or if the flag has been subsequently set on the dirfile using [**gd\_flags**(3)](/gd_flags/3.md). If this flag is not set, this function still updates the prefix, but GetData does not use it.

If **GD\_VERBOSE** is set, when the library encounters an error, it prints the supplied prefix (if any), followed immediately by the error message (which is the message returned by [**gd\_error\_string**(3)](/gd_error_string/3.md)), followed by a newline.  All output goes to the caller's standard error ([**stderr**(3)](/stderr/3.md)).

The  *dirfile* argument must point to a valid DIRFILE object previously created by a call to [**gd\_open**(3)](/gd_open/3.md).

## RETURN VALUE

Upon successful completion, **gd\_verbose\_prefix**() returns zero.  On error, it returns a negative-valued error code.  Possible error codes are:\
  .TP 8 **GD\_E\_ALLOC** The library was unable to allocate memory.

The error code is also stored in the **DIRFILE** object and may be retrieved after this function returns by calling [**gd\_error**(3)](/gd_error/3.md). A descriptive error string for the error may be obtained by calling [**gd\_error\_string**(3)](/gd_error_string/3.md).

## HISTORY

The **gd\_verbose\_prefix**() function appared in GetData-0.8.0.

In GetData-0.10.0, the error return from this function changed from -1 to a negative-valued error code.

## SEE ALSO

[**gd\_error**(3)](/gd_error/3.md), [**gd\_error\_string**(3)](/gd_error_string/3.md), [**gd\_flags**(3)](/gd_flags/3.md), [**gd\_open**(3)](/gd_open/3.md), [**stderr**(3)](/stderr/3.md), [dirfile(5)](/dirfile/5.md)
