---
name: "getudprefix"
section: "3"
platform: "linux"
package: "libxgks-dev"
version: "2.6.1+dfsg.2-17"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/getudprefix"
---

# getudprefix(3)

return installation prefix of Unidata software

## NAME

getudprefix - return installation prefix of Unidata software

## SYNOPSIS

```

const char *getudprefix(void);
```

## DESCRIPTION

This function returns the pathname of the directory off of which most Unidata-supported software is installed. Thus, it may be used during program execution to help form needed  pathnames. For example:

```
#include <string.h>
extern const char		*getudprefix(void);
char		pathbuf[256];
...
	(void)strcat(strcpy(pathbuf, getudprefix()),
		"/etc/udunits.dat");
```

The function returns the value of the environment variable **UDPREFIX**, if it exists; otherwise, the value of the environment variable **UDHOME** is returned, if it exists; otherwise, the home directory of the user database entry returned by \`**getuduser()' is used, if it exists; otherwise, the empty string** **("") is returned.**

## ENVIRONMENT

- UDPREFIX

  **Contains the pathname of the root of the installed, Unidata software.**

- UDHOME

  **Contains the pathname of the home directory of the Unidata user.**

## SEE ALSO

[**getuduser**(3)](/getuduser/3.md).
