ssize_t3type
Count of bytes
Part of size_t(3type).
Usage
#include <stddef.h>
typedef /* ... */ size_t;
#include <sys/types.h>
typedef /* ... */ ssize_t;
Library
Standard C library (libc)
Overview
- size_t
-
Used for a count of bytes. It is the result of the sizeof() operator. It is an unsigned integer type capable of storing values in the range [
0,SIZE_MAX].
- ssize_t
-
Used for a count of bytes or an error indication. It is a signed integer type capable of storing values at least in the range [
-1,SSIZE_MAX].
Use with printf(3) and scanf(3)
- ssize_t
-
glibc and most other implementations provide a length modifier for ssize_t for the printf(3) and the scanf(3) families of functions, which is
z; resulting commonly in%zdor%zifor printing ssize_t values. Althoughzworks for ssize_t on most implementations, portable POSIX programs should avoid using it—for example, by converting the value to intmax_t and using its length modifier (j).
Notes
- size_t
-
The following headers also provide size_t: <aio.h>, <glob.h>, <grp.h>, <iconv.h>, <monetary.h>, <mqueue.h>, <ndbm.h>, <pwd.h>, <regex.h>, <search.h>, <signal.h>, <stdio.h>, <stdlib.h>, <string.h>, <strings.h>, <sys/mman.h>, <sys/msg.h>, <sys/sem.h>, <sys/shm.h>, <sys/socket.h>, <sys/types.h>, <sys/uio.h>, <time.h>, <unistd.h>, <wchar.h>, and <wordexp.h>.
- ssize_t
-
The following headers also provide ssize_t: <aio.h>, <monetary.h>, <mqueue.h>, <stdio.h>, <sys/msg.h>, <sys/socket.h>, <sys/uio.h>, and <unistd.h>.
Releases
3 releases since Debian 12 (Bookworm); the text changed 2 times.