C Standard Library
[Last modified : 2003.07.09]
Contents
<assert.h>: Diagnostics<ctype.h>: Character Class Tests<errno.h>: Error Codes Reported by (Some) Library Functions<float.h>: Implementation-defined Floating-Point Limits<limits.h>: Implementation-defined Limits<locale.h>: Locale-specific Information<math.h>: Mathematical Functions<setjmp.h>: Non-local Jumps<signal.h>: Signals<stdarg.h>: Variable Argument Lists<stddef.h>: Definitions of General Use<stdio.h>: Input and Output<stdlib.h>: Utility functions<string.h>: String functions<time.h>: Time and Date functions
<assert.h>
-
Macro used for internal error detection. (Ignored if
NDEBUGis defined where<assert.h>is included.) If expression equals zero, message printed onstderrand abort called to terminate execution. Source filename and line number in message are from preprocessor macros__FILE__and__LINE__.
void assert(int expression);
[Contents]
<ctype.h>
-
isalpha(c)orisdigit(c) -
isupper(c)orislower(c) -
is control character. In ASCII, control characters are
0x00(NUL) to0x1F(US), and0x7F(DEL) - is decimal digit
- is printing character other than space
- is lower-case letter
-
is printing character (including space). In ASCII, printing characters are
0x20(' ') to0x7E('~') - is printing character other than space, letter, digit
- is space, formfeed, newline, carriage return, tab, vertical tab
- is upper-case letter
- is hexadecimal digit
- return lower-case equivalent
- return upper-case equivalent
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
[Contents]
<errno.h>
- object to which certain library functions assign specific positive values on error
- code used for domain errors
- code used for range errors
errno
EDOM
ERANGE
Notes:
- other implementation-defined error values are permitted
- to determine the value (if any) assigned to errno by a library function, a program should assign zero to errno immediately prior to the function call
[Contents]
<float.h>
- radix of floating-point representations
- floating-point rounding mode
FLT_RADIX
FLT_ROUNDS
Where the prefix "FLT" pertains to type float, "DBL" to type double, and "LDBL" to type long double:
- precision (in decimal digits)
-
smallest number
x such that
1.0 + x != 1.0 -
number of digits, base
FLT_RADIX, in mantissa - maximum number
-
largest positive integer exponent to which
FLT_RADIXcan be raised and remain representable - minimum normalised number
-
smallest negative integer exponent to which
FLT_RADIXcan be raised and remain representable
FLT_DIG
DBL_DIG
LDBL_DIG
FLT_EPSILON
DBL_EPSILON
LDBL_EPSILON
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
FLT_MAX
DBL_MAX
LDBL_MAX
FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
FLT_MIN
DBL_MIN
LDBL_MIN
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
[Contents]
<limits.h>
-
number of bits in a
char -
maximum value of type
char -
minimum value of type
char -
maximum value of type
signed char -
minimum value of type
signed char -
maximum value of type
unsigned char -
maximum value of type
short -
minimum value of type
short -
maximum value of type
unsigned short -
maximum value of type
int -
minimum value of type
int -
maximum value of type
unsigned int -
maximum value of type
long -
minimum value of type
long -
maximum value of type
unsigned long
CHAR_BIT
CHAR_MAX
CHAR_MIN
SCHAR_MAX
SCHAR_MIN
UCHAR_MAX
SHRT_MAX
SHRT_MIN
USHRT_MAX
INT_MAX
INT_MIN
UINT_MAX
LONG_MAX
LONG_MIN
ULONG_MAX
[Contents]
<locale.h>
-
Describes formatting of monetary and other numeric values:
- decimal point for non-monetary values
- sizes of digit groups for non-monetary values
- separator for digit groups for non-monetary values (left of "decimal point")
- currency symbol
- international currency symbol
- decimal point for monetary values
- sizes of digit groups for monetary values
- separator for digit groups for monetary values (left of "decimal point")
- negative sign for monetary values
- positive sign for monetary values
- number of digits to be displayed to right of "decimal point" for monetary values
- number of digits to be displayed to right of "decimal point" for international monetary values
-
whether currency symbol precedes (
1) or follows (0) negative monetary values -
whether currency symbol is (
1) or is not (0) separated by space from negative monetary values -
format for negative monetary values:
- parentheses surround quantity and currency symbol
- sign precedes quantity and currency symbol
- sign follows quantity and currency symbol
- sign immediately precedes currency symbol
- sign immediately follows currency symbol
01234 -
whether currency symbol precedes (
1) or follows (0) positive monetary values -
whether currency symbol is (
1) or is not (0) separated by space from non-negative monetary values -
format for non-negative monetary values, with values as for
n_sign_posn
char* decimal_point;char* grouping;char* thousands_sep;char* currency_symbol;char* int_curr_symbol;char* mon_decimal_point;char* mon_grouping;char* mon_thousands_sep;char* negative_sign;char* positive_sign;char frac_digits;char int_frac_digits;char n_cs_precedes;char n_sep_by_space;char n_sign_posn;char p_cs_precedes;char p_sep_by_space;char p_sign_posn;decimal_point. - returns pointer to formatting information for current locale
-
Sets components of locale according to specified
categoryandlocale. Returns string describing new locale or null on error. (Implementations are permitted to define values ofcategoryadditional to those describe here.) -
categoryargument for all categories -
categoryfor numeric formatting information -
categoryfor monetary formatting information -
categoryfor information affecting collating functions -
categoryfor information affecting character class tests functions -
categoryfor information affecting time conversions functions - null pointer constant
struct lconv
struct lconv* localeconv(void);
char* setlocale(int category, const char* locale);
LC_ALL
LC_NUMERIC
LC_MONETARY
LC_COLLATE
LC_CTYPE
LC_TIME
NULL
[Contents]
<math.h>
On domain error, implementation-defined value returned and errno set to EDOM. On range error, errno set to ERANGE and return value is HUGE_VAL with correct sign for overflow, or zero for underflow. Angles are in radians.
- magnitude returned (with correct sign) on overflow error
-
exponential of
x -
natural logarithm of
x -
base-10 logarithm of
x -
xraised to powery -
square root of
x -
smallest integer not less than
x -
largest integer not greater than
x -
absolute value of
x -
xtimes 2 to the powern -
if
xnon-zero, returns value, with absolute value in interval [1/2, 1), and assigns to*expinteger such that product of return value and 2 raised to the power*expequalsx; ifxzero, both return value and*expare zero -
returns fractional part and assigns to
*ipintegral part ofx, both with same sign asx -
if
ynon-zero, floating-point remainder ofx/y, with same sign asx; ifyzero, result is implementation-defined -
sine of
x -
cosine of
x -
tangent of
x -
arc-sine of
x -
arc-cosine of
x -
arc-tangent of
x -
arc-tangent of
y/x -
hyperbolic sine of
x -
hyperbolic cosine of
x -
hyperbolic tangent of
x
HUGE_VAL
double exp(double x);
double log(double x);
double log10(double x);
double pow(double x, double y);
double sqrt(double x);
double ceil(double x);
double floor(double x);
double fabs(double x);
double ldexp(double x, int n);
double frexp(double x, int* exp);
double modf(double x, double* ip);
double fmod(double x, double y);
double sin(double x);
double cos(double x);
double tan(double x);
double asin(double x);
double acos(double x);
double atan(double x);
double atan2(double y, double x);
double sinh(double x);
double cosh(double x);
double tanh(double x);
[Contents]
<setjmp.h>
- type of object holding context information
-
Saves context information in
envand returns zero. Subsequent call tolongjmpwith same env returns non-zero. -
Restores context saved by most recent call to
setjmpwith specifiedenv. Execution resumes as a second return fromsetjmp, with returned valuevalif specified value non-zero, or 1 otherwise.
jmp_buf
int setjmp(jmp_buf env);
void longjmp(jmp_buf env, int val);
[Contents]
<signal.h>
- abnormal termination
- arithmetic error
- invalid execution
- (asynchronous) interactive attention
- illegal storage access
- (asynchronous) termination request
- specifies default signal handling
-
signalreturn value indicating error - specifies that signal should be ignored
-
Install handler for subsequent signal
sig. If
handlerisSIG_DFL, implementation-defined default behaviour will be used; ifSIG_IGN, signal will be ignored; otherwise function pointed to byhandlerwill be invoked with argument sig. In the last case, handling is restored to default behaviour beforehandleris called. Ifhandlerreturns, execution resumes where signal occurred.signalreturns the previous handler orSIG_ERRon error. Initial state is implementation-defined. Implementations may may define signals additional to those listed here. -
Sends signal
sig. Returns zero on success.
SIGABRT
SIGFPE
SIGILL
SIGINT
SIGSEGV
SIGTERM
SIG_DFL
SIG_ERR
SIG_IGN
void (*signal(int sig, void (*handler)(int)))(int);
int raise(int sig);
[Contents]
<stdarg.h>
- type of object holding context information
-
Initialisation macro which must be called once before any unnamed argument is accessed. Stores context information in
ap.lastargis the last named parameter of the function. -
Yields value of the type (
type) and value of the next unnamed argument. - Termination macro which must be called once after argument processing and before exit from function.
va_list
void va_start(va_list ap, lastarg);
type va_arg(va_list ap, type);
void va_end(va_list ap);
[Contents]
<stddef.h>
- Null pointer constant.
-
Offset (in bytes) of member
mfrom start of structure typestype. - Type for objects declared to store result of subtracting pointers.
-
Type for objects declared to store result of
sizeofoperator.
NULL
offsetof(stype, m)
ptrdiff_t
size_t
[Contents]
<stdio.h>
-
Size of buffer used by
setbuf. - Value used to indicate end-of-stream or to report an error.
- Maximum length required for array of characters to hold a filename.
- Maximum number of files which may be open simultaneously.
-
Number of characters required for temporary filename generated by
tmpnam. - Null pointer constant.
-
Value for
originargument tofseekspecifying current file position. -
Value for
originargument tofseekspecifying end of file. -
Value for
originargument tofseekspecifying beginning of file. -
Minimum number of unique filenames generated by calls to
tmpnam. -
Value for
modeargument tosetvbufspecifying full buffering. -
Value for
modeargument tosetvbufspecifying line buffering. -
Value for
modeargument tosetvbufspecifying no buffering. - File pointer for standard input stream. Automatically opened when program execution begins.
- File pointer for standard output stream. Automatically opened when program execution begins.
- File pointer for standard error stream. Automatically opened when program execution begins.
- Type of object holding information necessary to control a stream.
- Type for objects declared to store file position information.
-
Type for objects declared to store result of
sizeofoperator. -
Opens file named
filenameand returns a stream, orNULLon failure.modemay be one of the following for text files:- text reading
- text writing
- text append
- text update (reading and writing)
- text update, discarding previous content (if any)
- text append, reading, and writing at end
"r""w""a""r+""w+""a+"bincluded (after the first character), for binary files. -
Closes file associated with
stream, then opens filefilenamewith specified mode and associates it withstream. ReturnsstreamorNULLon error. -
Flushes stream
streamand returns zero on success or EOF on error. Effect undefined for input stream.fflush(NULL)flushes all output streams. -
Closes stream
stream (after flushing, if output stream). Returns
EOFon error, zero otherwise. - Removes specified file. Returns non-zero on failure.
-
Changes name of file
oldnametonewname. Returns non-zero on failure. -
Creates temporary file (mode
"wb+") which will be removed when closed or on normal program termination. Returns stream orNULLon failure. -
Assigns to
s(ifsnon-null) and returns unique name for a temporary file. Unique name is returned for each of the firstTMP_MAXinvocations. -
Controls buffering for stream
stream.modeis_IOFBFfor full buffering,_IOLBFfor line buffering,_IONBFfor no buffering. Non-nullbufspecifies buffer of sizesizeto be used; otherwise, a buffer is allocated. Returns non-zero on error. Call must be before any other operation on stream. -
Controls buffering for stream
stream. For null
buf, turns off buffering, otherwise equivalent to(void)setvbuf(stream, buf, _IOFBF, BUFSIZ). -
Converts (according to format
format) and writes output to streamstream. Number of characters written, or negative value on error, is returned. Conversion specifications consist of:%- (optional) flag:
- left adjust
- always sign space
- space if no sign
- zero pad
-
Alternate form: for conversion character
o, first digit will be zero, for [xX], prefix0xor0Xto non-zero value, for [eEfgG], always decimal point, for [gG] trailing zeros not removed.
-+0# - (optional) minimum width: if specified as
*, value taken from next argument (which must beint). - (optional)
.(separating width from precision): - (optional) precision: for conversion character
s, maximum characters to be printed from the string, for [eEf], digits after decimal point, for [gG], significant digits, for an integer, minimum number of digits to be printed. If specified as*, value taken from next argument (which must beint). - (optional) length modifier:
-
shortorunsigned short -
longorunsigned long -
long double
hlL -
- conversion character:
-
intargument, printed in signed decimal notation -
intargument, printed in unsigned octal notation -
intargument, printed in unsigned hexadecimal notation -
intargument, printed in unsigned decimal notation -
intargument, printed as single character -
char*argument -
doubleargument, printed with format [-] mmm.ddd -
doubleargument, printed with format [-] m.dddddd(e|E)(+|-) xx -
doubleargument -
void*argument, printed as pointer -
int*argument : the number of characters written to this point is written into argument - no argument; prints %
d,iox,Xucsfe,Eg,Gpn% -
-
printf(f, ...)is equivalent tofprintf(stdout, f, ...) -
Like
fprintf, but output written into string
s, which must be large enough to hold the output, rather than to a stream. Output isNUL-terminated. Returns length (excluding the terminatingNUL). -
Equivalent to
fprintfwith variable argument list replaced byarg, which must have been initialised by theva_startmacro (and may have been used in calls tova_arg). -
Equivalent to
printfwith variable argument list replaced byarg, which must have been initialised by theva_startmacro (and may have been used in calls tova_arg). -
Equivalent to
sprintfwith variable argument list replaced byarg, which must have been initialised by theva_startmacro (and may have been used in calls tova_arg). -
Performs formatted input conversion, reading from stream
streamaccording to formatformat. The function returns whenformatis fully processed. Returns number of items converted and assigned, orEOFif end-of-file or error occurs before any conversion. Each of the arguments followingformatmust be a pointer. Format string may contain:- blanks and tabs, which are ignored
- ordinary characters, which are expected to match next non-white-space of input
- conversion specifications, consisting of:
%- (optional) assignment suppression character "
*" - (optional) maximum field width
- (optional) target width indicator:
-
argument is pointer to
shortrather thanint -
argument is pointer to
longrather thanint, ordoublerather thanfloat -
argument is pointer to
long doublerather thanfloat
hlL -
argument is pointer to
- conversion character:
-
decimal integer;
int*parameter required -
integer;
int*parameter required; decimal, octal or hex -
octal integer;
int*parameter required -
unsigned decimal integer;
unsigned int*parameter required -
hexadecimal integer;
int*parameter required -
characters;
char*parameter required; white-space is not skipped, andNUL-termination is not performed -
string of non-white-space;
char*parameter required; string isNUL-terminated -
floating-point number;
float*parameter required -
pointer value;
void*parameter required -
chars read so far;
int*parameter required -
longest non-empty string from specified set;
char*parameter required; string isNUL-terminated -
longest non-empty string not from specified set;
char*parameter required; string isNUL-terminated -
literal
%; no assignment
diouxcse,f,gpn[...][^...]% -
decimal integer;
-
scanf(f, ...)is equivalent tofscanf(stdin, f, ...) -
Like
fscanf, but input read from strings. -
Returns next character from (input) stream
stream, orEOFon end-of-file or error. -
Copies characters from (input) stream
streamtos, stopping whenn-1 characters copied, newline copied, end-of-file reached or error occurs. If no error,sisNUL-terminated. ReturnsNULLon end-of-file or error,sotherwise.
int
-
Writes
c, to streamstream. Returnsc, orEOFon error. -
Writes
s, to (output) stream stream. Returns non-negative on success orEOFon error. -
Equivalent to
fgetcexcept that it may be a macro. -
Equivalent to
getc(stdin). -
Copies characters from
stdinintosuntil newline encountered, end-of-file reached, or error occurs. Does not copy newline.NUL-terminatess. Returnss, orNULLon end-of-file or error. Should not be used because of the potential for buffer overflow. -
Equivalent to
fputcexcept that it may be a macro. -
putchar(c)is equivalent toputc(c, stdout). -
Writes
s(excluding terminatingNUL) and a newline tostdout. Returns non-negative on success,EOFon error. -
Pushes
c(which must not beEOF), onto (input) streamstreamsuch that it will be returned by the next read. Only one character of pushback is guaranteed (for each stream). Returnsc, orEOFon error. -
Reads (at most)
nobjobjects of sizesizefrom streamstreamintoptrand returns number of objects read. (feofandferrorcan be used to check status.) -
Writes to stream
stream,nobjobjects of sizesizefrom arrayptr. Returns number of objects written. -
Sets file position for stream
streamand clears end-of-file indicator. For a binary stream, file position is set tooffsetbytes from the position indicated byorigin: beginning of file forSEEK_SET, current position forSEEK_CUR, or end of file forSEEK_END. Behaviour is similar for a text stream, butoffsetmust be zero or, forSEEK_SETonly, a value returned byftell. Returns non-zero on error. -
Returns current file position for stream
stream, or-1on error. -
Equivalent to
fseek(stream, 0L, SEEK_SET); clearerr(stream). -
Stores current file position for stream
streamin*ptr. Returns non-zero on error. -
Sets current position of stream
stream to
*ptr. Returns non-zero on error. -
Clears end-of-file and error indicators for stream
stream. -
Returns non-zero if end-of-file indicator is set for stream
stream. -
Returns non-zero if error indicator is set for stream
stream. -
Prints
s(if non-null) andstrerror(errno)to standard error as would:fprintf(stderr, "%s: %s/n", (s != NULL ? s : ""), strerror(errno))
BUFSIZ
EOF
FILENAME_MAX
FOPEN_MAX
L_tmpnam
NULL
SEEK_CUR
SEEK_END
SEEK_SET
TMP_MAX
_IOFBF
_IOFBF
_IOFBF
stdin
stdout
stderr
FILE
fpos_t
size_t
FILE* fopen(const char* filename, const char* mode);
FILE* freopen(const char* filename, const char* mode, FILE* stream);
int fflush(FILE* stream);
int fclose(FILE* stream);
int remove(const char* filename);
int rename(const char* oldname, const char* newname);
FILE* tmpfile();
char* tmpname(char s[L_tmpnam]);
int setvbuf(FILE* stream, char* buf, int mode, size_t size);
void setbuf(FILE* stream, char* buf);
int fprintf(FILE* stream, const char* format, ...);
int printf(const char* format, ...);
int sprintf(char* s, const char* format, ...);
int vfprintf(FILE* stream, const char* format, va_list arg);
int vprintf(const char* format, va_list arg);
int vsprintf(char* s, const char* format, va_list arg);
int fscanf(FILE* stream, const char* format, ...);
int scanf(const char* format, ...);
int sscanf(char* s, const char* format, ...);
int fgetc(FILE* stream);
char* fgets(char* s, int n, FILE* stream);
fputc(int c, FILE* stream);
char* fputs(const char* s, FILE* stream);
int getc(FILE* stream);
int getchar(void);
char* gets(char* s);
int putc(int c, FILE* stream);
int putchar(int c);
int puts(const char* s);
int ungetc(int c, FILE* stream);
size_t fread(void* ptr, size_t size, size_t nobj, FILE* stream);
size_t fwrite(const void* ptr, size_t size, size_t nobj, FILE* stream);
int fseek(FILE* stream, long offset, int origin);
long ftell(FILE* stream);
void rewind(FILE* stream);
int fgetpos(FILE* stream, fpos_t* ptr);
int fsetpos(FILE* stream, const fpos_t* ptr);
void clearerr(FILE* stream);
int feof(FILE* stream);
int ferror(FILE* stream);
void perror(const char* s);
[Contents]
<stdlib.h>
-
Value for
statusargument toexitindicating failure. -
Value for
statusargument toexitindicating success. -
Maximum value returned by
rand(). - Null pointer constant.
-
Return type of
div(). Structure having members:- quotient
- remainder
int quot;int rem; -
Return type of
ldiv(). Structure having members:- quotient
- remainder
long quot;long rem; -
Type for objects declared to store result of
sizeofoperator. -
Returns absolute value of
n. -
Returns quotient and remainder of
num/denom. -
Equivalent to
strtod(s, (char**)NULL)except thaterrnois not necessarily set on conversion error. -
Equivalent to
(int)strtol(s, (char**)NULL, 10)except thaterrnois not necessarily set on conversion error. -
Equivalent to
strtol(s, (char**)NULL, 10)except thaterrnois not necessarily set on conversion error. -
Converts initial characters (ignoring leading white space) of
sto typedouble. Ifendpnon-null, stores pointer to unconverted suffix in*endp. On overflow, setserrnotoERANGEand returnsHUGE_VALwith the appropriate sign; on underflow, setserrnotoERANGEand returns zero; otherwise returns converted value. -
Converts initial characters (ignoring leading white space) of
sto typelong. Ifendpnon-nu ll, stores pointer to unconverted suffix in*endp. Ifbasebetween 2 and 36, that base used for conversion; if zero, leading (after any sign)0Xor0ximplies hexadecimal, leading0(after any sign) implies octal, otherwise decimal assumed. Leading0Xor0xpermitted for base hexadecimal. On overflow, setserrnotoERANGEand returnsLONG_MAXorLONG_MIN(as appropriate for sign); otherwise returns converted value. -
As for
strtolexcept result isunsigned longand value on overflow isULONG_MAX. -
Returns pointer to
zero-initialised newly-allocated space for an array of
nobjobjects each of sizesize, orNULLon error. -
Returns pointer to
uninitialised newly-allocated space for an object of size
size, or
NULLon error. -
Returns pointer to newly-allocated space for an object of size
size, initialised, to minimum of old and new sizes, to existing contents ofp(if non-null), orNULLon error. On success, old object deallocated, otherwise unchanged. -
If
pnon-null, deallocates space to which it points. -
Terminates program abnormally, by calling
raise(SIGABRT). -
Terminates program normally. Functions installed using
atexitare called (in reverse order to that in which installed), open files are flushed, open streams are closed and control is returned to environment.statusis returned to environment in implementation-dependent manner. Zero orEXIT_SUCCESSindicates successful termination andEXIT_FAILUREindicates unsuccessful termination. Implementations may define other values. -
Registers
fcnto be called when program terminates normally (or whenmainreturns). Returns non-zero on failure. -
If
sis notNULL, passessto environment for execution, and returns status reported by command processor; ifsisNULL, non-zero returned if environment has a command processor. -
Returns string associated with name
namefrom implementation's environment, orNULLif no such string exists. -
Searches ordered array
base(ofnobjects each of sizesize) for item matchingkeyaccording to comparison functioncmp.cmpmust return negative value if first argument is less than second, zero if equal and positive if greater. Items ofbaseare assumed to be in ascending order (according tocmp). Returns a pointer to an item matchingkey, orNULLif none found. -
Arranges into ascending order array
base(ofnobjects each of sizesize) according to comparison functioncmp.cmpmust return negative value if first argument is less than second, zero if equal and positive if greater. -
Returns pseudo-random number in range
0toRAND_MAX. -
Uses
seedas seed for new sequence of pseudo-random numbers. Initial seed is1.
EXIT_FAILURE
EXIT_SUCCESS
RAND_MAX
NULL
div_t
ldiv_t
size_t
int abs(int n);
long labs(long n);
div_t div(int num, int denom);
ldiv_t ldiv(long num, long denom);
double atof(const char* s);
int atoi(const char* s);
long atol(const char* s);
double strtod(const char* s, char** endp);
long strtol(const char* s, char** endp, int base);
unsigned long strtoul(const char* s, char** endp, int base);
void* calloc(size_t nobj, size_t size);
void* malloc(size_t size);
void* realloc(void* p, size_t size);
void free(void* p);
void abort();
void exit(int status);
int atexit(void (*fcm)(void));
int system(const char* s);
char* getenv(const char* name);
void* bsearch(const void* key, const void* base, size_t n, size_t size, int (*cmp)(const void* keyval, const void* datum));
void qsort(void* base, size_t n, size_t size, int (*cmp)(const void*, const void*));
int rand(void);
void srand(unsigned int seed);
[Contents]
<string.h>
- Null pointer constant.
-
Type for objects declared to store result of
sizeofoperator. -
Copies
cttosincluding terminatingNULand returnss. -
Copies at most
ncharacters ofcttos. Pads withNULcharacters ifctis of length less thann. Note that this may leaveswithoutNUL-termination. Returns. -
Concatenate
cttosand returns. -
Concatenate at most
ncharacters ofcttos.NUL-terminatessand return it. -
Compares
cswithct, returning negative value ifcs<ct, zero ifcs==ct, positive value ifcs>ct. -
Compares at most (the first)
ncharacters ofcsandct, returning negative value ifcs<ct, zero ifcs==ct, positive value ifcs>ct. -
Compares
cswithctaccording to locale, returning negative value ifcs<ct, zero ifcs==ct, positive value ifcs>ct. -
Returns pointer to first occurrence of
cincs, orNULLif not found. -
Returns pointer to last occurrence of
cincs, orNULLif not found. -
Returns length of prefix of
cswhich consists of characters which are inct. -
Returns length of prefix of
cswhich consists of characters which are not inct. -
Returns pointer to first occurrence in
csof any character ofct, orNULLif none is found. -
Returns pointer to first occurrence of
ctwithincs, orNULLif none is found. -
Returns length of
cs. -
Returns pointer to implementation-defined message string corresponding with error
n. -
Searches
sfor next token delimited by any character fromct. Non-NULLsindicates the first call of a sequence. If a token is found, it isNUL-terminated and returned, otherwiseNULLis returned.ctneed not be identical for each call in a sequence. -
Stores in
sno more thanncharacters (including terminatingNUL) of a string produced fromctaccording to a locale-specific transformation. Returns length of entire transformed string. -
Copies
ncharacters fromcttosand returnss.smay be corrupted if objects overlap. -
Copies
ncharacters fromcttosand returnss.swill not be corrupted if objects overlap. -
Compares at most (the first)
ncharacters ofcsandct, returning negative value ifcs<ct, zero ifcs==ct, positive value ifcs>ct. -
Returns pointer to first occurrence of
cin firstncharacters ofcs, orNULLif not found. -
Replaces each of the first
ncharacters ofsbycand returnss.
NULL
size_t
char* strcpy(char* s, const char* ct);
char* strncpy(char* s, const char* ct, size_t n);
char* strcat(char* s, const char* ct);
char* strncat(char* s, const char* ct, size_t n);
int strcmp(const char* cs, const char* ct);
int strncmp(const char* cs, const char* ct, size_t n);
int strcoll(const char* cs, const char* ct);
char* strchr(const char* cs, int c);
char* strrchr(const char* cs, int c);
size_t strspn(const char* cs, const char* ct);
size_t strcspn(const char* cs, const char* ct);
char* strpbrk(const char* cs, const char* ct);
char* strstr(const char* cs, const char* ct);
size_t strlen(const char* cs);
char* strerror(int n);
char* strtok(char* s, const char* t);
size_t strxfrm(char* s, const char* ct, size_t n);
void* memcpy(void* s, const void* ct, size_t n);
void* memmove(void* s, const void* ct, size_t n);
int memcmp(const void* cs, const void* ct, size_t n);
void* memchr(const void* cs, int c, size_t n);
void* memset(void* s, int c, size_t n);
[Contents]
<time.h>
-
The number of
clock_tunits per second. - Null pointer constant.
- An arithmetic type elapsed processor representing time.
- An arithmetic type representing calendar time.
-
Represents the components of calendar time:
- seconds after the minute
- minutes after the hour
- hours since midnight
- day of the month
- months since January
- years since 1900
- days since Sunday
- days since January 1
- Daylight Saving Time flag : is positive if DST is in effect, zero if not in effect, negative if information not known.
int tm_sec;int tm_min;int tm_hour;int tm_mday;int tm_mon;int tm_year;int tm_wday;int tm_yday;int tm_isdst; -
Returns elapsed processor time used by program or
-1if not available. -
Returns current calendar time or
-1if not available. Iftpis non-NULL, return value is also assigned to*tp. -
Returns the difference in seconds between
time2andtime1. -
If necessary, adjusts fields of
*tpto fall withing normal ranges. Returns the corresponding calendar time, or-1if it cannot be represented. -
Returns the given time as a string of the form:
Sun Jan 3 13:08:42 1988/n/0 -
Returns string equivalent to calendar time
tpconverted to local time. Equivalent to:
asctime(localtime(tp)) -
Returns calendar time
*tpconverted to Coordinated Universal Time, orNULLif not available. -
Returns calendar time
*tpconverted into local time. -
Formats
*tpintosaccording tofmt. Places no more thansmaxcharacters intos, and returns number of characters produced (excluding terminatingNUL), or0if greater thansmax. Formatting conversions (%c) are:- name of weekday
- abbreviated name of weekday
- name of month
- abbreviated name of month
- local date and time representation
-
day of month [
01-31] -
hour (24-hour clock) [
00-23] -
hour (12-hour clock) [
01-12] -
day of year [
001-366] -
minute [
00-59] -
month [
01-12] -
local equivalent of "
AM" or "PM" -
second [
00-61] -
week number of year (Sunday as 1st day of week) [
00-53] -
week number of year (Monday as 1st day of week) [
00-53] -
weekday (Sunday as
0) [0-6] - local time representation
- local date representation
- year with century
-
year without century [
00-99] - name (if any) of time zone
-
%
AaBbcdHIjMmpSUWwXxYyZ%
CLOCKS_PER_SEC
NULL
clock_t
time_t
struct tm
clock_t clock(void);
time_t time(time_t* tp);
double difftime(time_t time2, time_t time1);
time_t mktime(struct tm* tp);
char* asctime(const struct tm* tp);
char* ctime(const time_t* tp);
struct tm* gmtime(const time_t* tp);
struct tm* localtime(const time_t* tp);
size_t strftime(char* s, size_t smax, const char* fmt, const struct tm* tp);
Local time may differ from calendar time because of time zone.
[Contents]
RLR
4147

被折叠的 条评论
为什么被折叠?



