On Tue, 2 Apr 2019 16:45:30 +0300 Slavomir Kaslev <kaslevs@xxxxxxxxxx> wrote: > -static int write_ints(char *buf, size_t buf_len, int *arr, int arr_len) > +static unsigned int atou(const char *s) > +{ > + long r; > + > + r = atol(s); > + if (r >= 0 && r <= UINT_MAX) > + return r; > + > + return 0; > +} > + I wonder if we should do this instead: /* test a to u */ static int tatou(const char *s, int *res) { long r; r = atol(s); if (r >= 0 && r <= UINT_MAX) { *res = (unsigned)r; return 0; } return -1; } That way we could check for invalid ints. -- Steve