C语言库函数介绍

C语言库函数全面解读CHM版 C语言库函数是一组预先编写好的代码集合,这些函数封装了常见的功能,比如数据处理、数学计算、字符串操作等。程序员可以直接调用这些库函数,不必从头开始编写重复的代码,大大提高了开发效率。 阅读详情

C Standard Library

[Last modified : 2003.07.09]

Contents

<assert.h>

void assert(int expression);
Macro used for internal error detection. (Ignored if NDEBUG is defined where <assert.h> is included.) If expression equals zero, message printed on stderr and abort called to terminate execution. Source filename and line number in message are from preprocessor macros __FILE__ and __LINE__.

[Contents]

<ctype.h>

int isalnum(int c);
isalpha(c) or isdigit(c)
int isalpha(int c);
isupper(c) or islower(c)
int iscntrl(int c);
is control character. In ASCII, control characters are 0x00 ( NUL) to 0x1F ( US), and 0x7F ( DEL)
int isdigit(int c);
is decimal digit
int isgraph(int c);
is printing character other than space
int islower(int c);
is lower-case letter
int isprint(int c);
is printing character (including space). In ASCII, printing characters are 0x20 ( ' ') to 0x7E ( '~')
int ispunct(int c);
is printing character other than space, letter, digit
int isspace(int c);
is space, formfeed, newline, carriage return, tab, vertical tab
int isupper(int c);
is upper-case letter
int isxdigit(int c);
is hexadecimal digit
int tolower(int c);
return lower-case equivalent
int toupper(int c);
return upper-case equivalent

[Contents]

<errno.h>

errno
object to which certain library functions assign specific positive values on error
EDOM
code used for domain errors
ERANGE
code used for range errors

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>

FLT_RADIX
radix of floating-point representations
FLT_ROUNDS
floating-point rounding mode

Where the prefix "FLT" pertains to type float, "DBL" to type double, and "LDBL" to type long double:

FLT_DIG DBL_DIG LDBL_DIG
precision (in decimal digits)
FLT_EPSILON DBL_EPSILON LDBL_EPSILON
smallest number x such that 1.0 + x != 1.0
FLT_MANT_DIG DBL_MANT_DIG LDBL_MANT_DIG
number of digits, base FLT_RADIX, in mantissa
FLT_MAX DBL_MAX LDBL_MAX
maximum number
FLT_MAX_EXP DBL_MAX_EXP LDBL_MAX_EXP
largest positive integer exponent to which FLT_RADIX can be raised and remain representable
FLT_MIN DBL_MIN LDBL_MIN
minimum normalised number
FLT_MIN_EXP DBL_MIN_EXP LDBL_MIN_EXP
smallest negative integer exponent to which FLT_RADIX can be raised and remain representable

[Contents]

<limits.h>

CHAR_BIT
number of bits in a char
CHAR_MAX
maximum value of type char
CHAR_MIN
minimum value of type char
SCHAR_MAX
maximum value of type signed char
SCHAR_MIN
minimum value of type signed char
UCHAR_MAX
maximum value of type unsigned char
SHRT_MAX
maximum value of type short
SHRT_MIN
minimum value of type short
USHRT_MAX
maximum value of type unsigned short
INT_MAX
maximum value of type int
INT_MIN
minimum value of type int
UINT_MAX
maximum value of type unsigned int
LONG_MAX
maximum value of type long
LONG_MIN
minimum value of type long
ULONG_MAX
maximum value of type unsigned long

[Contents]

<locale.h>

struct lconv
Describes formatting of monetary and other numeric values:
char* decimal_point;
decimal point for non-monetary values
char* grouping;
sizes of digit groups for non-monetary values
char* thousands_sep;
separator for digit groups for non-monetary values (left of "decimal point")
char* currency_symbol;
currency symbol
char* int_curr_symbol;
international currency symbol
char* mon_decimal_point;
decimal point for monetary values
char* mon_grouping;
sizes of digit groups for monetary values
char* mon_thousands_sep;
separator for digit groups for monetary values (left of "decimal point")
char* negative_sign;
negative sign for monetary values
char* positive_sign;
positive sign for monetary values
char frac_digits;
number of digits to be displayed to right of "decimal point" for monetary values
char int_frac_digits;
number of digits to be displayed to right of "decimal point" for international monetary values
char n_cs_precedes;
whether currency symbol precedes ( 1) or follows ( 0) negative monetary values
char n_sep_by_space;
whether currency symbol is ( 1) or is not ( 0) separated by space from negative monetary values
char n_sign_posn;
format for negative monetary values:
0
parentheses surround quantity and currency symbol
1
sign precedes quantity and currency symbol
2
sign follows quantity and currency symbol
3
sign immediately precedes currency symbol
4
sign immediately follows currency symbol
char p_cs_precedes;
whether currency symbol precedes ( 1) or follows ( 0) positive monetary values
char p_sep_by_space;
whether currency symbol is ( 1) or is not ( 0) separated by space from non-negative monetary values
char p_sign_posn;
format for non-negative monetary values, with values as for n_sign_posn
Implementations may change field order and include additional fields. Standard C Library functions use only decimal_point.
struct lconv* localeconv(void);
returns pointer to formatting information for current locale
char* setlocale(int category, const char* locale);
Sets components of locale according to specified category and locale. Returns string describing new locale or null on error. (Implementations are permitted to define values of category additional to those describe here.)
LC_ALL
category argument for all categories
LC_NUMERIC
category for numeric formatting information
LC_MONETARY
category for monetary formatting information
LC_COLLATE
category for information affecting collating functions
LC_CTYPE
category for information affecting character class tests functions
LC_TIME
category for information affecting time conversions functions
NULL
null pointer constant

[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.

HUGE_VAL
magnitude returned (with correct sign) on overflow error
double exp(double x);
exponential of x
double log(double x);
natural logarithm of x
double log10(double x);
base-10 logarithm of x
double pow(double x, double y);
x raised to power y
double sqrt(double x);
square root of x
double ceil(double x);
smallest integer not less than x
double floor(double x);
largest integer not greater than x
double fabs(double x);
absolute value of x
double ldexp(double x, int n);
x times 2 to the power n
double frexp(double x, int* exp);
if x non-zero, returns value, with absolute value in interval [1/2, 1), and assigns to *exp integer such that product of return value and 2 raised to the power *exp equals x; if x zero, both return value and *exp are zero
double modf(double x, double* ip);
returns fractional part and assigns to *ip integral part of x, both with same sign as x
double fmod(double x, double y);
if y non-zero, floating-point remainder of x/y, with same sign as x; if y zero, result is implementation-defined
double sin(double x);
sine of x
double cos(double x);
cosine of x
double tan(double x);
tangent of x
double asin(double x);
arc-sine of x
double acos(double x);
arc-cosine of x
double atan(double x);
arc-tangent of x
double atan2(double y, double x);
arc-tangent of y/x
double sinh(double x);
hyperbolic sine of x
double cosh(double x);
hyperbolic cosine of x
double tanh(double x);
hyperbolic tangent of x

[Contents]

<setjmp.h>

jmp_buf
type of object holding context information
int setjmp(jmp_buf env);
Saves context information in env and returns zero. Subsequent call to longjmp with same env returns non-zero.
void longjmp(jmp_buf env, int val);
Restores context saved by most recent call to setjmp with specified env. Execution resumes as a second return from setjmp, with returned value val if specified value non-zero, or 1 otherwise.

[Contents]

<signal.h>

SIGABRT
abnormal termination
SIGFPE
arithmetic error
SIGILL
invalid execution
SIGINT
(asynchronous) interactive attention
SIGSEGV
illegal storage access
SIGTERM
(asynchronous) termination request
SIG_DFL
specifies default signal handling
SIG_ERR
signal return value indicating error
SIG_IGN
specifies that signal should be ignored
void (*signal(int sig, void (*handler)(int)))(int);
Install handler for subsequent signal sig. If handler is SIG_DFL, implementation-defined default behaviour will be used; if SIG_IGN, signal will be ignored; otherwise function pointed to by handler will be invoked with argument sig. In the last case, handling is restored to default behaviour before handler is called. If handler returns, execution resumes where signal occurred. signal returns the previous handler or SIG_ERR on error. Initial state is implementation-defined. Implementations may may define signals additional to those listed here.
int raise(int sig);
Sends signal sig. Returns zero on success.

[Contents]

<stdarg.h>

va_list
type of object holding context information
void va_start(va_list ap, lastarg);
Initialisation macro which must be called once before any unnamed argument is accessed. Stores context information in ap. lastarg is the last named parameter of the function.
type va_arg(va_list ap, type);
Yields value of the type ( type) and value of the next unnamed argument.
void va_end(va_list ap);
Termination macro which must be called once after argument processing and before exit from function.

[Contents]

<stddef.h>

NULL
Null pointer constant.
offsetof(stype, m)
Offset (in bytes) of member m from start of structure type stype.
ptrdiff_t
Type for objects declared to store result of subtracting pointers.
size_t
Type for objects declared to store result of sizeof operator.

[Contents]

<stdio.h>

BUFSIZ
Size of buffer used by setbuf.
EOF
Value used to indicate end-of-stream or to report an error.
FILENAME_MAX
Maximum length required for array of characters to hold a filename.
FOPEN_MAX
Maximum number of files which may be open simultaneously.
L_tmpnam
Number of characters required for temporary filename generated by tmpnam.
NULL
Null pointer constant.
SEEK_CUR
Value for origin argument to fseek specifying current file position.
SEEK_END
Value for origin argument to fseek specifying end of file.
SEEK_SET
Value for origin argument to fseek specifying beginning of file.
TMP_MAX
Minimum number of unique filenames generated by calls to tmpnam.
_IOFBF
Value for mode argument to setvbuf specifying full buffering.
_IOFBF
Value for mode argument to setvbuf specifying line buffering.
_IOFBF
Value for mode argument to setvbuf specifying no buffering.
stdin
File pointer for standard input stream. Automatically opened when program execution begins.
stdout
File pointer for standard output stream. Automatically opened when program execution begins.
stderr
File pointer for standard error stream. Automatically opened when program execution begins.
FILE
Type of object holding information necessary to control a stream.
fpos_t
Type for objects declared to store file position information.
size_t
Type for objects declared to store result of sizeof operator.
FILE* fopen(const char* filename, const char* mode);
Opens file named filename and returns a stream, or NULL on failure. mode may be one of the following for text files:
"r"
text reading
"w"
text writing
"a"
text append
"r+"
text update (reading and writing)
"w+"
text update, discarding previous content (if any)
"a+"
text append, reading, and writing at end
or one of those strings with b included (after the first character), for binary files.
FILE* freopen(const char* filename, const char* mode, FILE* stream);
Closes file associated with stream, then opens file filename with specified mode and associates it with stream. Returns stream or NULL on error.
int fflush(FILE* stream);
Flushes stream stream and returns zero on success or EOF on error. Effect undefined for input stream. fflush(NULL) flushes all output streams.
int fclose(FILE* stream);
Closes stream stream (after flushing, if output stream). Returns EOF on error, zero otherwise.
int remove(const char* filename);
Removes specified file. Returns non-zero on failure.
int rename(const char* oldname, const char* newname);
Changes name of file oldname to newname. Returns non-zero on failure.
FILE* tmpfile();
Creates temporary file (mode "wb+") which will be removed when closed or on normal program termination. Returns stream or NULL on failure.
char* tmpname(char s[L_tmpnam]);
Assigns to s (if s non-null) and returns unique name for a temporary file. Unique name is returned for each of the first TMP_MAX invocations.
int setvbuf(FILE* stream, char* buf, int mode, size_t size);
Controls buffering for stream stream. mode is _IOFBF for full buffering, _IOLBF for line buffering, _IONBF for no buffering. Non-null buf specifies buffer of size size to be used; otherwise, a buffer is allocated. Returns non-zero on error. Call must be before any other operation on stream.
void setbuf(FILE* stream, char* buf);
Controls buffering for stream stream. For null buf, turns off buffering, otherwise equivalent to (void)setvbuf(stream, buf, _IOFBF, BUFSIZ).
int fprintf(FILE* stream, const char* format, ...);
Converts (according to format format) and writes output to stream stream. 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
    0
    zero pad
    #
    Alternate form: for conversion character o, first digit will be zero, for [ xX], prefix 0x or 0X to non-zero value, for [ eEfgG], always decimal point, for [ gG] trailing zeros not removed.
  • (optional) minimum width: if specified as *, value taken from next argument (which must be int).
  • (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 be int).
  • (optional) length modifier:
    h
    short or unsigned short
    l
    long or unsigned long
    L
    long double
  • conversion character:
    d,i
    int argument, printed in signed decimal notation
    o
    int argument, printed in unsigned octal notation
    x,X
    int argument, printed in unsigned hexadecimal notation
    u
    int argument, printed in unsigned decimal notation
    c
    int argument, printed as single character
    s
    char* argument
    f
    double argument, printed with format [ -] mmm . ddd
    e,E
    double argument, printed with format [ -] m . dddddd( e| E)( +| -) xx
    g,G
    double argument
    p
    void* argument, printed as pointer
    n
    int* argument : the number of characters written to this point is written into argument
    %
    no argument; prints %
int printf(const char* format, ...);
printf(f, ...) is equivalent to fprintf(stdout, f, ...)
int sprintf(char* s, const char* format, ...);
Like fprintf, but output written into string s, which must be large enough to hold the output, rather than to a stream. Output is NUL-terminated. Returns length (excluding the terminating NUL).
int vfprintf(FILE* stream, const char* format, va_list arg);
Equivalent to fprintf with variable argument list replaced by arg, which must have been initialised by the va_start macro (and may have been used in calls to va_arg).
int vprintf(const char* format, va_list arg);
Equivalent to printf with variable argument list replaced by arg, which must have been initialised by the va_start macro (and may have been used in calls to va_arg).
int vsprintf(char* s, const char* format, va_list arg);
Equivalent to sprintf with variable argument list replaced by arg, which must have been initialised by the va_start macro (and may have been used in calls to va_arg).
int fscanf(FILE* stream, const char* format, ...);
Performs formatted input conversion, reading from stream stream according to format format. The function returns when format is fully processed. Returns number of items converted and assigned, or EOF if end-of-file or error occurs before any conversion. Each of the arguments following format must 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:
      h
      argument is pointer to short rather than int
      l
      argument is pointer to long rather than int, or double rather than float
      L
      argument is pointer to long double rather than float
    • conversion character:
      d
      decimal integer; int* parameter required
      i
      integer; int* parameter required; decimal, octal or hex
      o
      octal integer; int* parameter required
      u
      unsigned decimal integer; unsigned int* parameter required
      x
      hexadecimal integer; int* parameter required
      c
      characters; char* parameter required; white-space is not skipped, and NUL-termination is not performed
      s
      string of non-white-space; char* parameter required; string is NUL-terminated
      e,f,g
      floating-point number; float* parameter required
      p
      pointer value; void* parameter required
      n
      chars read so far; int* parameter required
      [...]
      longest non-empty string from specified set; char* parameter required; string is NUL-terminated
      [^...]
      longest non-empty string not from specified set; char* parameter required; string is NUL-terminated
      %
      literal %; no assignment
int scanf(const char* format, ...);
scanf(f, ...) is equivalent to fscanf(stdin, f, ...)
int sscanf(char* s, const char* format, ...);
Like fscanf, but input read from string s.
int fgetc(FILE* stream);
Returns next character from (input) stream stream, or EOF on end-of-file or error.
char* fgets(char* s, int n, FILE* stream);
Copies characters from (input) stream stream to s, stopping when n-1 characters copied, newline copied, end-of-file reached or error occurs. If no error, s is NUL-terminated. Returns NULL on end-of-file or error, s otherwise.
int fputc(int c, FILE* stream);
Writes c, to stream stream. Returns c, or EOF on error.
char* fputs(const char* s, FILE* stream);
Writes s, to (output) stream stream. Returns non-negative on success or EOF on error.
int getc(FILE* stream);
Equivalent to fgetc except that it may be a macro.
int getchar(void);
Equivalent to getc(stdin).
char* gets(char* s);
Copies characters from stdin into s until newline encountered, end-of-file reached, or error occurs. Does not copy newline. NUL-terminates s. Returns s, or NULL on end-of-file or error. Should not be used because of the potential for buffer overflow.
int putc(int c, FILE* stream);
Equivalent to fputc except that it may be a macro.
int putchar(int c);
putchar(c) is equivalent to putc(c, stdout).
int puts(const char* s);
Writes s (excluding terminating NUL) and a newline to stdout. Returns non-negative on success, EOF on error.
int ungetc(int c, FILE* stream);
Pushes c (which must not be EOF), onto (input) stream stream such that it will be returned by the next read. Only one character of pushback is guaranteed (for each stream). Returns c, or EOF on error.
size_t fread(void* ptr, size_t size, size_t nobj, FILE* stream);
Reads (at most) nobj objects of size size from stream stream into ptr and returns number of objects read. ( feof and ferror can be used to check status.)
size_t fwrite(const void* ptr, size_t size, size_t nobj, FILE* stream);
Writes to stream stream, nobj objects of size size from array ptr. Returns number of objects written.
int fseek(FILE* stream, long offset, int origin);
Sets file position for stream stream and clears end-of-file indicator. For a binary stream, file position is set to offset bytes from the position indicated by origin: beginning of file for SEEK_SET, current position for SEEK_CUR, or end of file for SEEK_END. Behaviour is similar for a text stream, but offset must be zero or, for SEEK_SET only, a value returned by ftell. Returns non-zero on error.
long ftell(FILE* stream);
Returns current file position for stream stream, or -1 on error.
void rewind(FILE* stream);
Equivalent to fseek(stream, 0L, SEEK_SET); clearerr(stream).
int fgetpos(FILE* stream, fpos_t* ptr);
Stores current file position for stream stream in *ptr. Returns non-zero on error.
int fsetpos(FILE* stream, const fpos_t* ptr);
Sets current position of stream stream to *ptr. Returns non-zero on error.
void clearerr(FILE* stream);
Clears end-of-file and error indicators for stream stream.
int feof(FILE* stream);
Returns non-zero if end-of-file indicator is set for stream stream.
int ferror(FILE* stream);
Returns non-zero if error indicator is set for stream stream.
void perror(const char* s);
Prints s (if non-null) and strerror(errno) to standard error as would:
fprintf(stderr, "%s: %s/n", (s != NULL ? s : ""), strerror(errno))

[Contents]

<stdlib.h>

EXIT_FAILURE
Value for status argument to exit indicating failure.
EXIT_SUCCESS
Value for status argument to exit indicating success.
RAND_MAX
Maximum value returned by rand().
NULL
Null pointer constant.
div_t
Return type of div(). Structure having members:
int quot;
quotient
int rem;
remainder
ldiv_t
Return type of ldiv(). Structure having members:
long quot;
quotient
long rem;
remainder
size_t
Type for objects declared to store result of sizeof operator.
int abs(int n); long labs(long n);
Returns absolute value of n.
div_t div(int num, int denom); ldiv_t ldiv(long num, long denom);
Returns quotient and remainder of num/denom.
double atof(const char* s);
Equivalent to strtod(s, (char**)NULL) except that errno is not necessarily set on conversion error.
int atoi(const char* s);
Equivalent to (int)strtol(s, (char**)NULL, 10) except that errno is not necessarily set on conversion error.
long atol(const char* s);
Equivalent to strtol(s, (char**)NULL, 10) except that errno is not necessarily set on conversion error.
double strtod(const char* s, char** endp);
Converts initial characters (ignoring leading white space) of s to type double. If endp non-null, stores pointer to unconverted suffix in *endp. On overflow, sets errno to ERANGE and returns HUGE_VAL with the appropriate sign; on underflow, sets errno to ERANGE and returns zero; otherwise returns converted value.
long strtol(const char* s, char** endp, int base);
Converts initial characters (ignoring leading white space) of s to type long. If endp non-nu ll, stores pointer to unconverted suffix in *endp. If base between 2 and 36, that base used for conversion; if zero, leading (after any sign) 0X or 0x implies hexadecimal, leading 0 (after any sign) implies octal, otherwise decimal assumed. Leading 0X or 0x permitted for base hexadecimal. On overflow, sets errno to ERANGE and returns LONG_MAX or LONG_MIN (as appropriate for sign); otherwise returns converted value.
unsigned long strtoul(const char* s, char** endp, int base);
As for strtol except result is unsigned long and value on overflow is ULONG_MAX.
void* calloc(size_t nobj, size_t size);
Returns pointer to zero-initialised newly-allocated space for an array of nobj objects each of size size, or NULL on error.
void* malloc(size_t size);
Returns pointer to uninitialised newly-allocated space for an object of size size, or NULL on error.
void* realloc(void* p, size_t size);
Returns pointer to newly-allocated space for an object of size size, initialised, to minimum of old and new sizes, to existing contents of p (if non-null), or NULL on error. On success, old object deallocated, otherwise unchanged.
void free(void* p);
If p non-null, deallocates space to which it points.
void abort();
Terminates program abnormally, by calling raise(SIGABRT).
void exit(int status);
Terminates program normally. Functions installed using atexit are called (in reverse order to that in which installed), open files are flushed, open streams are closed and control is returned to environment. status is returned to environment in implementation-dependent manner. Zero or EXIT_SUCCESS indicates successful termination and EXIT_FAILURE indicates unsuccessful termination. Implementations may define other values.
int atexit(void (*fcm)(void));
Registers fcn to be called when program terminates normally (or when main returns). Returns non-zero on failure.
int system(const char* s);
If s is not NULL, passes s to environment for execution, and returns status reported by command processor; if s is NULL, non-zero returned if environment has a command processor.
char* getenv(const char* name);
Returns string associated with name name from implementation's environment, or NULL if no such string exists.
void* bsearch(const void* key, const void* base, size_t n, size_t size, int (*cmp)(const void* keyval, const void* datum));
Searches ordered array base (of n objects each of size size) for item matching key according to comparison function cmp. cmp must return negative value if first argument is less than second, zero if equal and positive if greater. Items of base are assumed to be in ascending order (according to cmp). Returns a pointer to an item matching key, or NULL if none found.
void qsort(void* base, size_t n, size_t size, int (*cmp)(const void*, const void*));
Arranges into ascending order array base (of n objects each of size size) according to comparison function cmp. cmp must return negative value if first argument is less than second, zero if equal and positive if greater.
int rand(void);
Returns pseudo-random number in range 0 to RAND_MAX.
void srand(unsigned int seed);
Uses seed as seed for new sequence of pseudo-random numbers. Initial seed is 1.

[Contents]

<string.h>

NULL
Null pointer constant.
size_t
Type for objects declared to store result of sizeof operator.
char* strcpy(char* s, const char* ct);
Copies ct to s including terminating NUL and returns s.
char* strncpy(char* s, const char* ct, size_t n);
Copies at most n characters of ct to s. Pads with NUL characters if ct is of length less than n. Note that this may leave s without NUL-termination. Return s.
char* strcat(char* s, const char* ct);
Concatenate ct to s and return s.
char* strncat(char* s, const char* ct, size_t n);
Concatenate at most n characters of ct to s. NUL-terminates s and return it.
int strcmp(const char* cs, const char* ct);
Compares cs with ct, returning negative value if cs<ct, zero if cs==ct, positive value if cs>ct.
int strncmp(const char* cs, const char* ct, size_t n);
Compares at most (the first) n characters of cs and ct, returning negative value if cs<ct, zero if cs==ct, positive value if cs>ct.
int strcoll(const char* cs, const char* ct);
Compares cs with ct according to locale, returning negative value if cs<ct, zero if cs==ct, positive value if cs>ct.
char* strchr(const char* cs, int c);
Returns pointer to first occurrence of c in cs, or NULL if not found.
char* strrchr(const char* cs, int c);
Returns pointer to last occurrence of c in cs, or NULL if not found.
size_t strspn(const char* cs, const char* ct);
Returns length of prefix of cs which consists of characters which are in ct.
size_t strcspn(const char* cs, const char* ct);
Returns length of prefix of cs which consists of characters which are not in ct.
char* strpbrk(const char* cs, const char* ct);
Returns pointer to first occurrence in cs of any character of ct, or NULL if none is found.
char* strstr(const char* cs, const char* ct);
Returns pointer to first occurrence of ct within cs, or NULL if none is found.
size_t strlen(const char* cs);
Returns length of cs.
char* strerror(int n);
Returns pointer to implementation-defined message string corresponding with error n.
char* strtok(char* s, const char* t);
Searches s for next token delimited by any character from ct. Non- NULL s indicates the first call of a sequence. If a token is found, it is NUL-terminated and returned, otherwise NULL is returned. ct need not be identical for each call in a sequence.
size_t strxfrm(char* s, const char* ct, size_t n);
Stores in s no more than n characters (including terminating NUL) of a string produced from ct according to a locale-specific transformation. Returns length of entire transformed string.
void* memcpy(void* s, const void* ct, size_t n);
Copies n characters from ct to s and returns s. s may be corrupted if objects overlap.
void* memmove(void* s, const void* ct, size_t n);
Copies n characters from ct to s and returns s. s will not be corrupted if objects overlap.
int memcmp(const void* cs, const void* ct, size_t n);
Compares at most (the first) n characters of cs and ct, returning negative value if cs<ct, zero if cs==ct, positive value if cs>ct.
void* memchr(const void* cs, int c, size_t n);
Returns pointer to first occurrence of c in first n characters of cs, or NULL if not found.
void* memset(void* s, int c, size_t n);
Replaces each of the first n characters of s by c and returns s.

[Contents]

<time.h>

CLOCKS_PER_SEC
The number of clock_t units per second.
NULL
Null pointer constant.
clock_t
An arithmetic type elapsed processor representing time.
time_t
An arithmetic type representing calendar time.
struct tm
Represents the components of calendar time:
int tm_sec;
seconds after the minute
int tm_min;
minutes after the hour
int tm_hour;
hours since midnight
int tm_mday;
day of the month
int tm_mon;
months since January
int tm_year;
years since 1900
int tm_wday;
days since Sunday
int tm_yday;
days since January 1
int tm_isdst;
Daylight Saving Time flag : is positive if DST is in effect, zero if not in effect, negative if information not known.
Implementations may change field order and include additional fields.
clock_t clock(void);
Returns elapsed processor time used by program or -1 if not available.
time_t time(time_t* tp);
Returns current calendar time or -1 if not available. If tp is non- NULL, return value is also assigned to *tp.
double difftime(time_t time2, time_t time1);
Returns the difference in seconds between time2 and time1.
time_t mktime(struct tm* tp);
If necessary, adjusts fields of *tp to fall withing normal ranges. Returns the corresponding calendar time, or -1 if it cannot be represented.
char* asctime(const struct tm* tp);
Returns the given time as a string of the form:
Sun Jan 3 13:08:42 1988/n/0
char* ctime(const time_t* tp);
Returns string equivalent to calendar time tp converted to local time. Equivalent to:
asctime(localtime(tp))
struct tm* gmtime(const time_t* tp);
Returns calendar time *tp converted to Coordinated Universal Time, or NULL if not available.
struct tm* localtime(const time_t* tp);
Returns calendar time *tp converted into local time.
size_t strftime(char* s, size_t smax, const char* fmt, const struct tm* tp);
Formats *tp into s according to fmt. Places no more than smax characters into s, and returns number of characters produced (excluding terminating NUL), or 0 if greater than smax. Formatting conversions ( %c) are:
A
name of weekday
a
abbreviated name of weekday
B
name of month
b
abbreviated name of month
c
local date and time representation
d
day of month [ 01- 31]
H
hour (24-hour clock) [ 00- 23]
I
hour (12-hour clock) [ 01- 12]
j
day of year [ 001- 366]
M
minute [ 00- 59]
m
month [ 01- 12]
p
local equivalent of " AM" or " PM"
S
second [ 00- 61]
U
week number of year (Sunday as 1st day of week) [ 00- 53]
W
week number of year (Monday as 1st day of week) [ 00- 53]
w
weekday (Sunday as 0) [ 0- 6]
X
local time representation
x
local date representation
Y
year with century
y
year without century [ 00- 99]
Z
name (if any) of time zone
%
%

Local time may differ from calendar time because of time zone.

[Contents]


RLR
手把手教你用nRF52832+RFX2401C设计远距离蓝牙模块(附完整原理图/PCB文件) 本文详细介绍了如何利用nRF52832 SoC与RFX2401C射频前端芯片设计远距离蓝牙模块,涵盖芯片选型、阻抗匹配、PCB布局等关键环节。通过实战指南和完整原理图/PCB文件,帮助工程师实现输出功率可达20dBm的蓝牙模块设计,适用于智能家居、运动追踪等物联网应用。 阅读详情

相关推荐

腾讯云滑动图片验证码实现

<button @click="varify"> 验证 </button> <script src="https://ssl.captcha.qq.com/TCaptcha.js"></script> <script> export default { name:'test', data(){ return{ } }, methods:{ //获取图片滑动验证码 varify() .

weixin_44996006的博客 1591

ANDORID~支持的设备

很少人关注这个问题,我不多说,你没事看下,会有些特殊变化: 下表列出了 Google Play 支持的设备。此列表是按制造商名称的首字母排序的。您也可以在此页面中查找自己的设备(PC:Ctrl + F,苹果机:Command + F)。 如果您在使用 Google Play 网站或 Google Play 商店应用时遇到问题,请确保您的设备包含在下表中。如果不在,我们建议您与设备制造商...

mmdev 1771

经纬度转换为UTM坐标

UTM(通用横向墨卡托投影): 是一种以米为单位的坐标系统,用于地图和GPS导航。将地球划分为60个纵向的区域。每个区域宽6度,从赤道开始往南北两级方向划分。每个区域都有一个特定的字母。

weixin_45626706的博客 7298

VIM 使用命令

vim使用大全[转] vi/vim 基本使用方法 本文介绍了vi (vim)的基本使用方法,但对于普通用户来说基本上够了! vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令。由于对Unix及Linux系统的任何版本,vi编辑器是完全相同的,因此您可以在其他任何介绍vi的地方进一步了解它。Vi也是Li

石头的专栏 777

JMeter脚本录制-快速上手篇

有的项目应用场景下,压测时,需要考虑带宽因素,压测不只是压测接口,静态资源也要一起压测。一般来说,静态资源比较多,如果一个个手工去写请求,是比较繁琐的,此时,可以使用Jmeter的脚本录制功能。 步骤1,创建脚本录制模版。 JMeter菜单:文件>模版,下拉选择到Recording,点击“Create”按钮; 填写录制参数: hostToRecord:填写要录制的主机域名,例如,我们这里填入:www.baidu.com schemeToRecord:填写要录制的模式,例如,htt...

软件测试大叔 5737

MuJoCo新手必看:5分钟搞定你的第一个机器人仿真(附Python代码)

本文为零基础新手提供了一份详尽的MuJoCo物理仿真引擎入门指南。从环境搭建、MJCF模型文件解析,到编写Python控制代码,手把手教你5分钟内创建并运行第一个机器人仿真。内容涵盖双摆模型控制与自定义四轮小车构建,帮助你快速掌握这一高性能开源工具,迈出机器人学与强化学习仿真的第一步。

weixin_29032489的博客 662

账户和钱包(官网的中文版)

重要的提示 本课程适用于私有单节点testnet(如Docker快速入门),但可以在公共网络上进行微小修改。 介绍   课程观众 本课程适用于想要了解钱包和帐户管理,如何使用cleos管理钱包和帐户以及钱包和帐户管理EOSIO组件如何相互交互的开发人员。有关清除的更多信息,请参阅Cleos Command Reference   你将学到什么 您将学习如何创建和管理钱包及其密钥,然...

9522

扩散模型学习顺序推荐

非常建议大家先从VAE(变分自动编码器)到DDPM,VAE可以帮助大家了解扩散目标提出的思路。DDPM是扩散模型最经典和基础的,务必了解。在前期了解DDIM可以先跳过,可以在学了部分后面的内容再了解。目前,我已经进行了不少扩散模型的论文精读,涉及到的论文系列如下,大家也可以按照这个顺序来学习。后续有时间,我再把手写的笔记整理为电子版,再分享给大家。剩下这3块是不同的方向,可以任选一块开始。每块关键的学习内容,见上述。(1)从同一视角理解扩散模型(VAE)(从统一视角理解扩散模型)

hallo128的博客 1487

ubuntu1604安装 LNMP

Ubuntu (including in-development releases) are supported in this PPA:* Precise (12.04)* Trusty (14.04)* Wily (15.10)* Xenial (16.04)The following releases of Ubuntu are no longer supported, and have had their packages removed from the PPA:* Lucid (10.04)*

gxl_ct001的专栏 377

”COMSOL“竟然如此简单!我悟了!!

COMSOL Multiphysics具有强大的多物理场全耦合仿真分析功能、高效的计算性能,可以保证数值仿真的高度精确,已被广泛应用于各个学科领域,近年来运用COMSOL来解决电化学实际工程问题也越来越普遍。

C1012562281的博客 3459

计算机组成原理实验:手把手教你用模拟程序实现中断机制(附完整代码)

本文通过一个计算机组成原理模拟实验,手把手教你从零实现一个可工作的中断系统。实验详细演示了如何配置中断控制器、编写主程序与中断服务程序,并观察中断响应、现场保护和恢复的全过程,深入解析了中断原理的核心机制。

479

使用docker快速在Ubuntu上安装eosio本地测试环境

1、docker获取eosio镜像: (1)官网获取:这种方式跟自己网络有很大关系,有的网不好的很难下载下来,所以推荐方式(2) docker pull eosio/eos:v1.4.2 (2)从以下获取镜像的.tar文件,放到Ubuntu中, 其中的eosio.tar下载地址为: 压缩镜像文件下载地址 使用如下命令导入为镜像文件即可,需要等待一两分钟时间。 docker lo...

xp_lx12的博客 1473

MATLAB - 机械臂手眼标定(眼在手内) - 估计安装在机器人上的移动相机的姿态

执行手眼校准有助于操作配备末端执行器(简称 “手”)的机械臂,该末端执行器依赖于摄像头提供的视觉数据。一旦完成了眼在手外的校准,机械臂就能准确地移动到摄像头识别的特定像素位置。这种能力是执行精确拾放任务(如分类、堆垛和分拣)的基础,即使在摄像机的确切位置和方向未知的情况下也是如此。机器人-摄像机系统有两种构型:眼在手内和眼在手外。在眼在手内构型中,摄像头直接安装在机器人手臂的末端执行器上。相反,在眼在手的构型中,摄像头固定在一个静止的物体上,机器人手臂在其视野内。

机器人控制与仿真应用 3364

c语言库 strcpy函数介绍,以及实现

strcpy 是一个简单但有风险的字符串复制函数,使用时需要注意目标缓冲区的大小。使用时可以考虑更安全的函数,如 strncpy,它允许限制复制的字符数,避免溢出的风险。

hzz812503533的博客 740

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

C语言库函数malloc和free介绍

在计算机中内存可以简单分为三个储存区,分别是栈区(存放局部变量、函数形参),堆区(动态内存分配),静态区(静态变量、全局变量)。本篇文章将围绕计算机中的自由存储区——“堆”来谈谈动态内存分配函数malloc()和free()。 malloc和free函数介绍 C语言提供了一个动态内存开辟的函数: void* malloc (size_t size); 这个函数向内存申请一块连续可用的空间,并返回指向这块空间的指针。 如果开辟成功,则返回一个指向开辟好空间的指针。 如果开辟失败,则返回一个NUL

久留不见i的博客 1501

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

C语言库函数:strtok() 、strtok_r()介绍

C语言库函数:strtok() 、strtok_r()介绍;

wanghongshuai1的博客 842

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

C语言库函数strstr的功能介绍与模拟实现

找的过程显然是一个循环,只要cp没有指向\0我们就让他继续找,找的过程中是*s1与*s2比较,如果二者相等就一直比较,直到一方出现了\0,如果*s1已经是\0但是*s2不是\0,说明str1中已经不可能找到str2,我们直接返回NULL,如果发现*s2是\0,那不管此时*s1是不是\0,都已经找到了str2,此时返回cp。如果cp都已经指向了\0,说明肯定找不到了,返回NULL(实际上只要cp指向的字符串比str2短就不可能找到了)注:这种写法有点像暴力枚举法,效率还是比较低的。模拟实现strstr()

2301_76771985的博客 760

c语言库函数字体和字号,C语言中的字符串处理库函数介绍与实现

strlen函数:求字符串的长度size_t strlen(const char *s)头文件:#include说明:求出s指向的字符串的长度(不包括null字符)。返回值:返回s指向的字符串的长度。size_t strlen(const char *s){size_t len = 0;while(*s++)len++;return len;}strcpy和strncpy函数:复制字符串char ...

weixin_33601504的博客 194

C语言库函数源码下载仓库

C语言库函数源码下载仓库 【下载地址】C语言库函数源码下载仓库 此开源项目提供了一份完整的C语言库函数源码,涵盖了常用的标准库函数实现,是深入了解C语言标准库内部工作机制的宝贵资源。源码经过精心整理,结构清晰,便于阅读和理解,非常适合C语言学习者和开发者使用。通过下载并阅读这些源码,您可以深入掌握每个函数的实现原理和用法...

gitblog_06784的博客 395

STC15单片机C语言库函数版本UART_RXD_TXD_Short参数介绍

STC15单片机C语言库函数版本UART_RXD_TXD_Short参数介绍 官方示例代码下载位置: https://www.stcmcudata.com/ 库函数版本 在串口初始化配置函数里面的COMx_InitStructure.UART_RXD_TXD_Short = ENABLE; //内部短路RXD与TXD, 做中继,之前不明白注释是什么意思,默认是disable,如果将此项参数配置成enable,意思就是,将串口收到的信息全部发送出去,也就是成了转发的作用,官方注释上是写的中

perseverance51博客 780

C语言库中的字符函数

本文介绍了C语言中常用的字符串处理函数,包括求字符串长度的strlen、字符串拷贝的strcpy/strncpy、字符串拼接的strcat/strncat、字符串比较的strcmp/strncmp、查找子字符串的strstr、分割字符串的strtok等。详细讲解了每个函数的功能特点、参数说明、使用注意事项,并通过具体代码示例演示其用法。此外,还介绍了错误信息处理函数strerror和字符分类转换函数,为字符串操作提供了全面的参考指南。

SixLegs的博客 1347

【免费下载】 C语言库函数查找工具MSDN

C语言库函数查找工具MSDN 【下载地址】C语言库函数查找工具MSDN 本资源提供了一款专为C语言学习者和开发者设计的库函数查询工具——MSDN。这款工具极大地便利了程序员们在编码过程中对C语言标准库函数的查找与理解。通过它,你可以迅速定位到你需要的函数详情,包括但不限于函数的使用方法、参数说明、返回值以及示例代码 ...

gitblog_06540的博客 780

C语言库函数查找工具MSDN

一、前言 库函数在我们写程序的时候会在很大程度上提高我们的效率,我知道很多人可能像我一样,很多时候并不是不知道可以用库函数来实现,但就是不知道库函数如何使用,所以今天呢博主就来推荐资源了——C语言库函数查找工具《MSDN》(百度网盘提取码:MSDN),后面将会演示如何使用的,同时博客还给大家推荐一些链接,也可以查看的:推荐大家使用英文版的,看不懂也可以用谷歌翻译哟 cplusplus.com zh.cppreference.com 二、MSDN 函数搜索 函数的介绍 关于get

qq_47799626的博客 5619

C语言库函数— qsort () 详解

C语言库函数qsort()详细介绍

qq_74009838的博客 1万+

#60 C语言库函数和使用方式

我们知道了C语言中函数分为:库函数和自定义函数,这个小结我们在更进一步的学习一下C语言库函数和使用的方法。

小鑠的博客 176

【亲测免费】 C语言库函数速查手册

C语言库函数速查手册 去发现同类优质开源项目:https://gitcode.com/ 本仓库提供了《C语言库函数速查手册》,这是一份全面的语言库函数速查资料,包含了大量的C语言库函数。手册内容详尽,可以帮助开发者快速查找和理解C语言的各类库函数,是学习、使用C语言的宝贵参考资料。无论您是C语言初学者还是资深开发者,这份手册都能为您提供便捷的查询服务。 去发现同类优质开源项目:https://g...

gitblog_06781的博客 397
上一篇: 算法之贪婪算法
下一篇: 又一新项目下来,准备改用.net来实现!
shipfi
博客等级 码龄24年 7粉丝 50原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值