libite
Functions
chomp.c File Reference
#include <errno.h>
#include <string.h>
Include dependency graph for chomp.c:

Functions

char * chomp (char *str)
 Perl like chomp function, chop off last char(s) if newline. More...
 

Detailed Description

Author
Joachim Wiberg
Date
2014-2021

Function Documentation

◆ chomp()

char* chomp ( char *  str)

Perl like chomp function, chop off last char(s) if newline.

Parameters
strString to chomp

This function is like Perl chomp, but it's set to chop of all trailing newlines. Useful in combination with fgets().

Returns
str, or NULL with errno set, if str is not a valid pointer.
Exceptions
EINVALif the input argument is not a valid pointer.