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

# atoa(3abz)

convert a string to an address

## NAME

atoa - convert a string to an address

## LIBRARIES

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

## SYNOPSIS

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

int atoa(in_addr_t *addr, const char *str);
```

## DESCRIPTION

The **atoa()** function converts a string to an address. The string may either be a hostname or an ip address.

The address is stored in network byte order.

## RETURN VALUE

The **atoa()** 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 GETHOSTBYNAME flag, only ip addresses may be specified.

At the time of writing, the glibc library gethostbyname() function had a bug which caused it to resolve some invalid hostnames. In order to detect those cases, the **atoa()** function also does a reverse lookup using gethostbyaddr() to see if the domain really exist.

## SEE ALSO

[hosts(5)](/hosts/5.md), [resolver(5)](/resolver/5.md)

## AUTHOR

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