HobNote
GCC library Memo
since 2006.11.06
last update 2011.01.08



ctype.h

function name
note
extern int tolower
    (int __c)
    __THROW
Return the lowercase version of C.
extern int toupper
    (int __c)
    __THROW
Return the uppercase version of C.



stdio.h

define value note
EOF -1 End of file character
SEEK_SET 0 Seek from beginning of file
SEEK_CUR 1 Seek from current position
SEEK_END 2 Seek from end of file


function name
note
int remove
    (__const char *__filename)
    __THROW
Remove file FILENAME
int rename
    (__const char *__old,
    __const char *__new)
    __THROW
Rename file OLD to NEW
int fclose
    (FILE *__stream)
Close STREAM
int fflush
    (FILE *__stream)
Flush STREAM, or all streams if STREAM is NULL.
FILE *fopen
    (__const char *__restrict __filename,
    __const char *__restrict __modes)
Open a file and create a new stream for it
FILE *freopen
    (__const char *__restrict __filename,
    __const char *__restrict __modes,
    FILE *__restrict __stream)
Open a file, replacing an existing stream with it
void setbuf
    (FILE *__restrict __stream,
    char *__restrict __buf)
    __THROW
If BUF is NULL, make STREAM unbuffered.
Else make it use buffer BUF, of size BUFSIZ
int setvbuf
    (FILE *__restrict __stream,
    char *__restrict __buf,
    int __modes, size_t __n)
    __THROW
Make STREAM use buffering mode MODE
int fprintf
    (FILE *__restrict __stream,
    __const char *__restrict __format, ...)
Write formatted output to STREAM
int printf
    (__const char *__restrict __format, ...)
Write formatted output to stdout
int sprintf
    (char *__restrict __s,
    __const char *__restrict __format, ...)
    __THROW
Write formatted output to S
int vfprintf
    (FILE *__restrict __s,
    __const char *__restrict __format,
    _G_va_list __arg)
Write formatted output to S from argument list ARG
int vsprintf
    (char *__restrict __s,
    __const char *__restrict __format,
    _G_va_list __arg)
    __THROW
Write formatted output to S from argument list ARG
int fscanf
    (FILE *__restrict __stream,
    __const char *__restrict __format, ...)
Read formatted input from STREAM
int scanf
    (__const char *__restrict __format, ...)
Read formatted input from stdin
int sscanf
    (__const char *__restrict __s,
    __const char *__restrict __format, ...)
    __THROW
Read formatted input from S
int fgetc
    (FILE *__stream)
    int getc
    (FILE *__stream)
Read a character from STREAM
int getchar
    (void)
Read a character from stdin
int fputc
    (int __c,
    FILE *__stream)
    int putc
    (int __c,
    FILE *__stream)
Write a character to STREAM
int putchar
    (int __c)
Write a character to stdout
char *fgets
    (char *__restrict __s,
    int __n,
    FILE *__restrict __stream
Get a newline-terminated string
of finite length from STREAM
char *gets
    (char *__s)
Get a newline-terminated string from stdin,
removing the newline.
DO NOT USE THIS FUNCTION!!
There is no limit on how much it will read
int fputs
    (__const char *__restrict __s,
    FILE *__restrict __stream)
Write a string to STREAM
int puts
    (__const char *__s)
Write a string, followed by a newline, to stdout.
int ungetc
    (int __c,
    FILE *__stream)
Push a character back onto the input buffer of STREAM
size_t fread
    (void *__restrict __ptr, size_t __size,
    size_t __n,
    FILE *__restrict __stream)
Read chunks of generic data from STREAM
size_t fwrite
    (__const void *__restrict __ptr,
    size_t __size,
    size_t __n,
    FILE *__restrict __s)
Write chunks of generic data to STREAM
int fseek
    (FILE *__stream,
    long int __off,
    int __whence)
Seek to a certain position on STREAM
long int ftell
    (FILE *__stream)
Return the current position of STREAM
void rewind
    (FILE *__stream)
Rewind to the beginning of STREAM
int fgetpos
    (FILE *__restrict __stream,
    fpos_t *__restrict __pos)
Get STREAM's position
int fsetpos
    (FILE *__stream,
    __const fpos_t *__pos)
Set STREAM's position
void clearerr
    (FILE *__stream)
    __THROW
Clear the error and EOF indicators for STREAM
int feof
    (FILE *__stream)
    __THROW
Return the EOF indicator for STREAM
int ferror
    (FILE *__stream)
    __THROW
Return the error indicator for STREAM
void perror
    (__const char *__s)
Print a message describing the meaning of the value of errno



stdlib.h

define value note
RAND_MAX 2147483647 The largest number rand will return (same as INT_MAX).
EXIT_FAILURE 1 Failing exit status.
EXIT_SUCCESS 0 Successful exit status.


function name
note
extern double strtod
    (__const char *__restrict __nptr,
    char **__restrict __endptr)
    __THROW __nonnull ((1))
Convert a string to a floating-point number.
extern long int strtol
    (__const char *__restrict __nptr,
    char **__restrict __endptr,
    int __base)
    __THROW __nonnull ((1))
Convert a string to a long integer.
extern unsigned long int strtoul
    (__const char *__restrict __nptr,
    char **__restrict __endptr,
    int __base)
    __THROW __nonnull ((1))
Convert a string to an unsigned long integer.
extern int rand
    (void)
    __THROW
Return a random integer between 0 and RAND_MAX inclusive.
extern void srand
    (unsigned int __seed)
    __THROW
Seed the random number generator with the given number.
extern void *malloc
    (size_t __size)
    __THROW __attribute_malloc__
Allocate SIZE bytes of memory.
extern void *calloc
    (size_t __nmemb,
    size_t __size)
    __THROW __attribute_malloc__
Allocate NMEMB elements of SIZE bytes each, all initialized to 0.
extern void *realloc
    (void *__ptr,
    size_t __size)
    __THROW __attribute_malloc__
Re-allocate the previously allocated block in PTR, making the new block SIZE bytes long.
extern int atexit
    (void (*__func) (void))
    __THROW __nonnull ((1))
Register a function to be called when `exit' is called.
extern void exit
    (int __status)
    __THROW __attribute__ ((__noreturn__))
Call all functions registered with `atexit' and `on_exit',
in the reverse of the order in which they were registered
perform stdio cleanup, and terminate program execution with STATUS.
extern char *getenv
    (__const char *__name)
    __THROW __nonnull ((1))
Return the value of envariable NAME, or NULL if it doesn't exist.
extern int system
    (__const char *__command)
Execute the given line as a shell command.

This function is a cancellation point and therefore not marked with
__THROW.
extern void *bsearch
    (__const void *__key,
    __const void *__base,
    size_t __nmemb,
    size_t __size,
    __compar_fn_t __compar)
    __nonnull ((1, 2, 5))
Do a binary search for KEY in BASE, which consists of NMEMB elements
of SIZE bytes each, using COMPAR to perform the comparisons.
extern void qsort
    (void *__base,
    size_t __nmemb,
    size_t __size,
    __compar_fn_t __compar)
    __nonnull ((1, 4))
Sort NMEMB elements of BASE, of SIZE bytes each,
using COMPAR to perform the comparisons.
extern int abs
    (int __x)
    __THROW __attribute__ ((__const__))
extern long int labs
    (long int __x)
    __THROW __attribute__ ((__const__))
Return the absolute value of X.
extern div_t div
    (int __numer,
    int __denom)
    __THROW __attribute__ ((__const__))
extern ldiv_t ldiv
    (long int __numer,
    long int __denom)
    __THROW __attribute__ ((__const__))
Return the `div_t', `ldiv_t' or `lldiv_t' representation
of the value of NUMER over DENOM.
GCC may have built-ins for these someday.
extern int mblen
    (__const char *__s,
    size_t __n)
    __THROW
Return the length of the multibyte character
in S, which is no longer than N.
extern int mbtowc
    (wchar_t *__restrict __pwc,
    __const char *__restrict __s,
    size_t __n)
    __THROW
Return the length of the given multibyte character,
putting its `wchar_t' representation in *PWC.
extern int wctomb
    (char *__s,
    wchar_t __wchar)
    __THROW
Put the multibyte character represented
by WCHAR in S, returning its length.
extern size_t mbstowcs
    (wchar_t *__restrict __pwcs,
    __const char *__restrict __s,
    size_t __n)
    __THROW
Convert a multibyte string to a wide char string.
extern size_t wcstombs
    (char *__restrict __s,
    __const wchar_t *__restrict __pwcs,
    size_t __n)
    _THROW
Convert a wide char string to multibyte string.



string.h

function name
note
extern void *memcpy
    (void *__restrict __dest,
    __const void *__restrict __src,
    size_t __n)
    __THROW __nonnull ((1, 2))
Copy N bytes of SRC to DEST.
extern void *memmove
    (void *__dest,
    __const void *__src,
    size_t __n)
    __THROW __nonnull ((1, 2))
Copy N bytes of SRC to DEST, guaranteeing
correct behavior for overlapping strings.
extern void *memset
    (void *__s,
    int __c,
    size_t __n)
    __THROW __nonnull ((1))
Set N bytes of S to C.
extern int memcmp
    (__const void *__s1,
    __const void *__s2,
    size_t __n)
    __THROW __attribute_pure__ __nonnull ((1, 2))
Compare N bytes of S1 and S2.
extern void *memchr
    (__const void *__s,
    int __c,
    size_t __n)
    __THROW __attribute_pure__ __nonnull ((1))
Search N bytes of S for C.
extern char *strcpy
    (char *__restrict __dest,
    __const char *__restrict __src)
    __THROW __nonnull ((1, 2))
Copy SRC to DEST.
extern char *strncpy
    (char *__restrict __dest,
    __const char *__restrict __src,
    size_t __n)
    __THROW __nonnull ((1, 2))
Copy no more than N characters of SRC to DEST.
extern char *strcat
    (char *__restrict __dest,
    __const char *__restrict __src)
    __THROW __nonnull ((1, 2))
Append SRC onto DEST.
extern char *strncat
    (char *__restrict __dest,
    __const char *__restrict __src,
    size_t __n)
    __THROW __nonnull ((1, 2))
Append no more than N characters from SRC onto DEST.
extern int strcmp
    (__const char *__s1,
    __const char *__s2)
    __THROW __attribute_pure__ __nonnull ((1, 2))
Compare S1 and S2.
extern int strncmp
    (__const char *__s1,
    __const char *__s2,
    size_t __n)
    __THROW __attribute_pure__ __nonnull ((1, 2))
Compare N characters of S1 and S2.
extern int strcoll
    (__const char *__s1,
    __const char *__s2)
    __THROW __attribute_pure__ __nonnull ((1, 2))
Compare the collated forms of S1 and S2.
extern size_t strxfrm
    (char *__restrict __dest,
    __const char *__restrict __src,
    size_t __n)
    __THROW __nonnull ((2))
Put a transformation of SRC into no more than N bytes of DEST.
extern char *strchr
    (__const char *__s,
    int __c)
    __THROW __attribute_pure__ __nonnull ((1))
Find the first occurrence of C in S.
extern char *strrchr
    (__const char *__s,
    int __c)
    __THROW __attribute_pure__ __nonnull ((1))
Find the last occurrence of C in S.
extern size_t strcspn
    (__const char *__s,
    __const char *__reject)
    __THROW __attribute_pure__ __nonnull ((1, 2))
Return the length of the initial segment of S which consists entirely of characters not in REJECT.
extern size_t strspn
    (__const char *__s,
    __const char *__accept)
    __THROW __attribute_pure__ __nonnull ((1, 2))
Return the length of the initial segment of S which consists entirely of characters in ACCEPT.
extern char *strpbrk
    (__const char *__s,
    __const char *__accept)
    __THROW __attribute_pure__ __nonnull ((1, 2))
Find the first occurrence in S of any character in ACCEPT.
extern char *strstr
    (__const char *__haystack,
    __const char *__needle)
    __THROW __attribute_pure__ __nonnull ((1, 2))
Find the first occurrence of NEEDLE in HAYSTACK.
extern char *strtok
    (char *__restrict __s,
    __const char *__restrict __delim)
    __THROW __nonnull ((2))
Divide S into tokens separated by characters in DELIM.
extern size_t strlen
    (__const char *__s)
    __THROW __attribute_pure__ __nonnull ((1))
Return the length of S.
extern char *strerror
    (int __errnum)
    __THROW
Return a string describing the meaning of the `errno' code in ERRNUM.