21. Services Provided by C Library (libc)¶
21.1. Introduction¶
This section lists the routines that provided by the Newlib C Library.
21.2. Standard Utility Functions (stdlib.h)¶
abort
- Abnormal termination of a programabs
- Integer absolute value (magnitude)assert
- Macro for Debugging Diagnosticsatexit
- Request execution of functions at program exitatof
- String to double or floatatoi
- String to integerbsearch
- Binary searchcalloc
- Allocate space for arraysdiv
- Divide two integersecvtbuf
- Double or float to string of digitsecvt
- Double or float to string of digits (malloc result)__env_lock
- Lock environment list for getenv and setenvgvcvt
- Format double or float as stringexit
- End program executiongetenv
- Look up environment variablelabs
- Long integer absolute value (magnitude)ldiv
- Divide two long integersmalloc
- Allocate memoryrealloc
- Reallocate memoryfree
- Free previously allocated memorymallinfo
- Get information about allocated memory__malloc_lock
- Lock memory pool for malloc and freembstowcs
- Minimal multibyte string to wide string convertermblen
- Minimal multibyte lengthmbtowc
- Minimal multibyte to wide character converterqsort
- Sort an arrayrand
- Pseudo-random numbersstrtod
- String to double or floatstrtol
- String to longstrtoul
- String to unsigned longsystem
- Execute command stringwcstombs
- Minimal wide string to multibyte string converterwctomb
- Minimal wide character to multibyte converter
21.3. Character Type Macros and Functions (ctype.h)¶
isalnum
- Alphanumeric character predicateisalpha
- Alphabetic character predicateisascii
- ASCII character predicateiscntrl
- Control character predicateisdigit
- Decimal digit predicateislower
- Lower-case character predicateisprint
- Printable character predicates (isprint, isgraph)ispunct
- Punctuation character predicateisspace
- Whitespace character predicateisupper
- Uppercase character predicateisxdigit
- Hexadecimal digit predicatetoascii
- Force integers to ASCII rangetolower
- Translate characters to lower casetoupper
- Translate characters to upper case
21.4. Input and Output (stdio.h)¶
clearerr
- Clear file or stream error indicatorfclose
- Close a filefeof
- Test for end of fileferror
- Test whether read/write error has occurredfflush
- Flush buffered file outputfgetc
- Get a character from a file or streamfgetpos
- Record position in a stream or filefgets
- Get character string from a file or streamfiprintf
- Write formatted output to file (integer only)fopen
- Open a filefdopen
- Turn an open file into a streamfputc
- Write a character on a stream or filefputs
- Write a character string in a file or streamfread
- Read array elements from a filefreopen
- Open a file using an existing file descriptorfseek
- Set file positionfsetpos
- Restore position of a stream or fileftell
- Return position in a stream or filefwrite
- Write array elements from memory to a file or streamgetc
- Get a character from a file or stream (macro)getchar
- Get a character from standard input (macro)gets
- Get character string from standard input (obsolete)iprintf
- Write formatted output (integer only)mktemp
- Generate unused file nameperror
- Print an error message on standard errorputc
- Write a character on a stream or file (macro)putchar
- Write a character on standard output (macro)puts
- Write a character string on standard outputremove
- Delete a file’s namerename
- Rename a filerewind
- Reinitialize a file or streamsetbuf
- Specify full buffering for a file or streamsetvbuf
- Specify buffering for a file or streamsiprintf
- Write formatted output (integer only)printf
- Write formatted outputscanf
- Scan and format inputtmpfile
- Create a temporary filetmpnam
- Generate name for a temporary filevprintf
- Format variable argument list
21.5. Strings and Memory (string.h)¶
bcmp
- Compare two memory areasbcopy
- Copy memory regionsbzero
- Initialize memory to zeroindex
- Search for character in stringmemchr
- Find character in memorymemcmp
- Compare two memory areasmemcpy
- Copy memory regionsmemmove
- Move possibly overlapping memorymemset
- Set an area of memoryrindex
- Reverse search for character in stringstrcasecmp
- Compare strings ignoring casestrcat
- Concatenate stringsstrchr
- Search for character in stringstrcmp
- Character string comparestrcoll
- Locale specific character string comparestrcpy
- Copy stringstrcspn
- Count chars not in stringstrerror
- Convert error number to stringstrlen
- Character string lengthstrlwr
- Convert string to lower casestrncasecmp
- Compare strings ignoring casestrncat
- Concatenate stringsstrncmp
- Character string comparestrncpy
- Counted copy stringstrpbrk
- Find chars in stringstrrchr
- Reverse search for character in stringstrspn
- Find initial matchstrstr
- Find string segmentstrtok
- Get next token from a stringstrupr
- Convert string to upper casestrxfrm
- Transform string
21.6. Signal Handling (signal.h)¶
raise
- Send a signalsignal
- Specify handler subroutine for a signal
21.7. Time Functions (time.h)¶
asctime
- Format time as stringclock
- Cumulative processor timectime
- Convert time to local and format as stringdifftime
- Subtract two timesgmtime
- Convert time to UTC (GMT) traditional representationlocaltime
- Convert time to local representationmktime
- Convert time to arithmetic representationstrftime
- Flexible calendar time formattertime
- Get current calendar time (as single number)
21.8. Locale (locale.h)¶
setlocale
- Select or query locale
21.9. Reentrant Versions of Functions¶
Equivalent for errno variable: -
errno_r
- XXXLocale functions:
localeconv_r
- XXXsetlocale_r
- XXX
Equivalents for stdio variables:
stdin_r
- XXXstdout_r
- XXXstderr_r
- XXX
Stdio functions:
fdopen_r
- XXXperror_r
- XXXtempnam_r
- XXXfopen_r
- XXXputchar_r
- XXXtmpnam_r
- XXXgetchar_r
- XXXputs_r
- XXXtmpfile_r
- XXXgets_r
- XXXremove_r
- XXXvfprintf_r
- XXXiprintf_r
- XXXrename_r
- XXXvsnprintf_r
- XXXmkstemp_r
- XXXsnprintf_r
- XXXvsprintf_r
- XXXmktemp_t
- XXXsprintf_r
- XXX
Signal functions:
init_signal_r
- XXXsignal_r
- XXXkill_r
- XXX_sigtramp_r
- XXXraise_r
- XXX
Stdlib functions:
calloc_r
- XXXmblen_r
- XXXsrand_r
- XXXdtoa_r
- XXXmbstowcs_r
- XXXstrtod_r
- XXXfree_r
- XXXmbtowc_r
- XXXstrtol_r
- XXXgetenv_r
- XXXmemalign_r
- XXXstrtoul_r
- XXXmallinfo_r
- XXXmstats_r
- XXXsystem_r
- XXXmalloc_r
- XXXrand_r
- XXXwcstombs_r
- XXXmalloc_r
- XXXrealloc_r
- XXXwctomb_r
- XXXmalloc_stats_r
- XXXsetenv_r
- XXX
String functions:
strtok_r
- XXX
System functions:
close_r
- XXXlink_r
- XXXunlink_r
- XXXexecve_r
- XXXlseek_r
- XXXwait_r
- XXXfcntl_r
- XXXopen_r
- XXXwrite_r
- XXXfork_r
- XXXread_r
- XXXfstat_r
- XXXsbrk_r
- XXXgettimeofday_r
- XXXstat_r
- XXXgetpid_r
- XXXtimes_r
- XXX
Time function:
asctime_r
- XXX
21.10. Miscellaneous Macros and Functions¶
unctrl
- Return printable representation of a character
21.11. Variable Argument Lists¶
Stdarg (stdarg.h):
va_start
- XXXva_arg
- XXXva_end
- XXX
Vararg (varargs.h):
va_alist
- XXXva_start-trad
- XXXva_arg-trad
- XXXva_end-trad
- XXX
21.12. Reentrant System Calls¶
open_r
- XXXclose_r
- XXXlseek_r
- XXXread_r
- XXXwrite_r
- XXXfork_r
- XXXwait_r
- XXXstat_r
- XXXfstat_r
- XXXlink_r
- XXXunlink_r
- XXXsbrk_r
- XXX