---
name: "atop"
section: "3abz"
platform: "linux"
package: "libabz0-dev"
version: "0.5.1"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/atop/3abz"
---

# atop(3abz)

convert a string to a port number

## NAME

atop - convert a string to a port number

## LIBRARIES

Abz Library (-labz), Debug Library (-ldebug)

## SYNOPSIS

```
#include <abz/atop.h>

int atop(in_port_t *port, const char *str);
```

## DESCRIPTION

The **atop()** function converts a string to a port number. The string may either be a service as specified in /etc/services or a port number.

The port number is stored in network byte order.

## RETURN VALUE

The **atop()** function returns 0 if successful or -1 if some error occurred. Check errno to see what error occurred.

## NOTES

None of the libabz routines are thread-safe. I'm not planning to change this either! For more information, please see http://threading.2038bug.com/

If the library was compiled without the GETSERVBYNAME flag, only port numbers may be specified.

## SEE ALSO

[services(5)](/services/5.md)

## AUTHOR

Written by Abraham vd Merwe \<abz@blio.com\>
