C language library function introduction

xiaoxiao2021-03-06  91

C Standard Library

[Last Modified: 2003.07.09]

Contents

: Diagnostics : Character Class Tests : Error Codes reported by (some) library functions : importation-defined floating-points : Implementation-defined limits : locale-specifications : Mathematical Functions : non-local jumps : signals : variable argument Lists : definitions of general use : input and output : utility functions : string functions : Time and Date functions

Void Assert (int Expression);

Macro Used for Internal Error Detection. (Ignored IF

NDebug is defined Where

is incdaded.) IF

Expression Equals Zero, Message Printed On

STDERR AND

Abort caled to terminate Execution. Source Filename and Line Number in Message Are Are from Preprocessor Macros

__File__ and

__LINE__.

[Contents]

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

Object to which

Certain Library Functions Assign Specific Positive Values ​​on Error

EDOM

Code Used for domain errors

Ereg

Code Used for Range Errors

NOTES:

Other importation-defined to determine the value (if any) assigned to errno by a library function, a proteo by a library function, a proteo by a library function, a proteo by a library function, a program shop

[Contents]

FLT_RADIX

Radix of floating-point representations

FLT_ROUNDs

FLOATING-POINT ROUNDING MODE

WHERE The Prefix "fl" 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

Smallst 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 Normaliad Number

FLT_MIN_EXP

DBL_MIN_EXP

LDBL_MIN_EXP

Smallst Negative Integer Exponent to which

FLT_RADIX Can Be Raised and Remain Representable

[Contents]

Char_bit

Number of bits in a

charr

Char_max

Maximum Value Of Type

charr

Char_min

Minimum Value Of Type

charr

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_MAXMAXIMUM 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]

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-monTary 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 * posTIVE_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;

WHETER 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 Symbol2

Sign Follows Quantity and Currency Symbol

3

SIGN IMMEDIATELY Precedes Currency Symbol

4

Sign Immediely Follows Currency Symbol

CHAR P_CS_PRECEDES;

WHETER 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 value

CHAR P_SIGN_POSN;

Format For Non-Negative Monetary Values, with Values ​​as for

N_SIGN_POSN

Implementations May Change Field ORDER AND INCLUDE ADDITILDS.

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

Category Additional To Those Describe Here.)

LC_all

Category Argument for All Categories

LC_NUMERIC

Category for numeric formatting information

LC_MONTARY

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]

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 OFX

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);

Smallst 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]

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]

Sigabrt

Abnormal Termination

SIGFPE

Arithmetic Error

SIGILL

INVALID EXECUTION

Sigint

(asynchronous) intective attention

Sigsegv

Illegal Storage Access

Sigterm

(asynchronous) Termination request

SIG_DFL

Specifies Default Signal Handling

SIG_ERR

Signal Return Value INDICATION Error

SIG_IGN

Specifies That Signal Should BE IGNORED

Void (* Signal (int SIGNAL) (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 copy, handling is

Restored to Default Behaviour Before

Handler is caled. 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]

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]

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]

BUFSIZ

Size of buffer buy by

setbuf.

EOF

Value use to indeicate 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. Automatic Or Opened When Program Execution Begins.

STDOUT

File Pointer for Standard Output Stream. Automatic Or Opened When Program Execution Begins.

Stderr

File Pointer for Standard Error Stream. Automatic Or 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, ATING, And Writing At end

O Ooney 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

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 * 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:

hide

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 NotaNe

U

INT Argument, Printed in unsigned Decimal Notation

c

INT Argument, Printed As Single Characters

Char * argument

fly

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 character of character of character 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 Street. 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 Initialiad 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 Initialiad 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 Initialiad 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.

Format is fully processed. Returns Number of items Converted and assigned, or

EOF if end-of-file or error opcurs before any converness. Each of the arguments stockingformat

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 "*" Maximum Field Width (Optional) Target Width Indicator:

hide

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:

di

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

Street, or

EOF on end-of-file or error.

Char * fgets (char * s, int n, file * stream);

COPIES CHARACTERS from (Input) stream

Street to

S, Stopping When

N-1 CHARACTERS COPIED, Newline Copied, End-of-file reached or error ivus. 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

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 return 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 * Street, 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 indeicated 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

Street, or

-1 on error.

Void Rewind (file * stream);

Equivalent to

FSeek (stream, 0l, seek_set); Clearerr (Stream).

INT FGETPOS (file * stream, fpos_t * ptr);

Store 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

Street 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]

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 byrand ().

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)

s Type

Double. IF

ENDP NON-NULL, Stores Pointer to Unconverted SUFFIX IN

* Endp. on overflow, sets

Errno to

ERANGE AND RETURNS

Hue_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)

s 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, setserrno to

ERANGE AND RETURNS

Long_max or

Long_min (AS Appropriate for Sign); OtherWise Returns Converted Value.

Unsigned long start (const char * s, char **);

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-Initialiad 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

Uninitialiad 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, Initialiad, 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 Abnormal, 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 INDICES 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, Passs

S TO Environment For Execution, And Returns Status Reported by Command Processor; IFS 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 claim string exists.

Void * bsearch (const void * key, const void * base, size_t n, size_t size, int (* cmp) (const void * dam);

Searches Ordered Array

Base

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 *);

Arrange Into Ascending Order Array

Base

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 SED for New Sequence of Pseudo-Random Numbers. Initial Seed IS

1.

[Contents]

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 incruding 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. Returns.

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

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

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

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 Idicates The First Call of A Sequence. if a token is found, IT IS

Nul-Terminated and Returned, Otherwise

Null is returned.

CT NEED NOTE 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 local-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

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);

Replace Each of the First

N Characters of

s by

C and returns

s.

[Contents]

Clocks_Per_Sec

The Number of

Clock_t units per second.

NULL

Null Pointer Constant.

Clock_T

An Arithmetic Type Elapsed Processor Repesenting Time.

Time_t

An Arithmetic Type Repensenting Calendar Time.

Struct TM

Represents The Components of Calendar Time:

INTTM_SEC;

Seconds after the minute

INTTM_MIN;

Minutes instator

INTTM_HOUR;

Hours Since Midnight

INTTM_MDAY;

Day of the month

INTTM_MON; MONTHS

Since January

INTTM_YEAR;

Years Since 1900

INTTM_WDAY;

Days Since Sunday

INTTM_YDAY;

Days Since January 1

INTTM_ISDST;

Daylight Saving Time Flag: IS Positive IF DST IS IN Effect, Zero If Not In Effect, Negative IF Information Not know.

Implementations May Change Field ORDER AND INCLUDE ADDITILDS.

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))

StructTM * GMTIME (const time_t * tp);

Returns Calendar Time

* TP Converted to Coordinated Universal Time, OR

Null if not available.

StructTM * 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 return Number of Characters Product (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 Monthc

Local Date and Time Repesentation

di

Day of month

01-

31]

Hide

Hour (24-Hour Clock) [

00-

twenty three]

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 Wear) [

00-

53]

W

Week Number of Year (Monday As 1st Day Of Wear) [

00-

53]

w

Weekday (Sunday AS)

0)

0-

6]

X

Local Time Repesentation

x

Local Date Repesentation

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

转载请注明原文地址:https://www.9cbs.com/read-96597.html

New Post(0)