YAZ  5.34.0
Functions
atoin.c File Reference

Implements atoi_n function. More...

#include <string.h>
#include <yaz/marcdisp.h>
#include <yaz/yaz-iconv.h>

Go to the source code of this file.

Functions

int atoi_n (const char *buf, int len)
 like atoi(3) except that it reads exactly len characters More...
 
int atoi_n_check (const char *buf, int size, int *val)
 like atoi_n but checks for proper formatting More...
 

Detailed Description

Implements atoi_n function.

Definition in file atoin.c.

Function Documentation

◆ atoi_n()

int atoi_n ( const char *  buf,
int  len 
)

like atoi(3) except that it reads exactly len characters

Parameters
bufbuffer to read
lennumber of bytes to consider (being digits)
Returns
value

Definition at line 19 of file atoin.c.

References yaz_isdigit.

Referenced by atoi_n_check(), and yaz_marc_read_iso2709().

◆ atoi_n_check()

int atoi_n_check ( const char *  buf,
int  size,
int *  val 
)

like atoi_n but checks for proper formatting

Parameters
bufbuffer to read values from
sizesize of buffer
valvalue of decimal number (if successful)
Return values
0no value found (non-digits found)
1value found and *val holds value

Definition at line 32 of file atoin.c.

References atoi_n(), and yaz_isdigit.

Referenced by convert_solrmarc(), replace_node(), yaz_marc_read_iso2709(), yaz_marc_read_line(), yaz_marc_set_leader(), yaz_marc_write_check(), yaz_marc_write_iso2709(), yaz_marc_write_json(), yaz_marc_write_line(), yaz_marc_write_marcxml_wrbuf(), yaz_marc_write_xml(), and yaz_marc_write_xml_turbo_xml().