---
name: "getln"
section: "3"
platform: "linux"
package: "qmail"
version: "1.06-6.2~deb10u1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/getln"
---

# getln(3)

read one line of data

## NAME

getln - read one line of data

## SYNTAX

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

int **getln**(&*ss*,&*sa*,&*match*,*sep*);

substdio *ss*;\
 stralloc *sa*;\
 int *match*;\
 int *sep*;

## DESCRIPTION

**getln** reads a line of characters, terminated by a  *sep* character, from *ss*. It returns the line in *sa* and sets *match* to 1.

If **getln** sees end-of-input before it sees *sep*, it returns the partial line in *sa* and sets *match* to 0.

**getln** normally returns 0. If it runs out of memory, or encounters an error from *ss*, it returns -1, setting **errno** appropriately.

## SEE ALSO

[stralloc(3)](/stralloc/3.md), substdio(3), [getln2(3)](/getln2/3.md)
