---
name: "lib"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:19.2.1+dfsg-2+deb9u3"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/lib"
---

# lib(3erl)

Useful library functions.

## NAME

lib - Useful library functions.

## DESCRIPTION

**Warning:**

This module is retained for backward compatibility. It can disappear without warning in a future Erlang/OTP release.

## EXPORTS

```
error_message(Format, Args) -> ok
```

Types:

Format = **io:format()**\
 Args = \[term()\]\

Prints error message *Args* in accordance with *Format*. Similar to *io:format/2*.

```
flush_receive() -> ok
```

Flushes the message buffer of the current process.

```
nonl(String1) -> String2
```

Types:

String1 = String2 = string()\

Removes the last newline character, if any, in *String1*.

```
progname() -> atom()
```

Returns the name of the script that started the current Erlang session.

```
send(To, Msg) -> Msg
```

Types:

To = pid() \| atom() \| {atom(), node()}\
 Msg = term()\

Makes it possible to send a message using the *apply/3* BIF.

```
sendw(To, Msg) -> term()
```

Types:

To = pid() \| atom() \| {atom(), node()}\
 Msg = term()\

As *send/2*, but waits for an answer. It is implemented as follows:

```
sendw(To, Msg) ->
    To ! {self(),Msg},
    receive
        Reply -> Reply
    end.
```

The returned message is not necessarily a reply to the sent message.
