Anda di halaman 1dari 63

A Dictionary of ANSI Standard C Function Definitions

ANSI STANDARD C FUNCTION DEFINITIONS FOR THE CURIOUS THE DESPERATE THE FRANTIC AND THE SUICIDAL
Version 1.2.5 Updated 10 April 2005
The material contained in this ebook is not to be altered or copied without written permission from the author. Geoffrey Trott 1998 t_geoffrey@hotmail.com Useful reference Books C PRIMA PLUS 4 EDITION by Stephen Prata (C99) THE STANDARD C LIBRARY by PJ Plauger (C89)

Baby Style Coupons

ABCDEFGILMOPQRSTUVW LIBRARIES
C89
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (1 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

assert.h stdarg.h

ctype.h stddef.h

locale.h stdio.h

math.h setjmp.h stdlib.h string.h

signal.h time.h

C99
complex.h ctype.h fenv.h inttypes.h math.h stdio.h stdlib.h string.h time.h stdarg.h

wchar.h wctype.h

abort
void abort (void)
HEADER stdlib.h

PURPOSE This function causes the program which calls it to end abruptly, unless SIGABRT is caught and the interrupt handler function defined by signal() does not return. RESULT No values are returned by this function. NOTES Whether files open when abort() is called are closed, or information contained within buffers linked to those files transferred, is implementation defined. abort() calls raise (SIGABRT), which returns an implementation defined message confirming unsuccessful termination to the operating system. Although ANSI does not require it, many implementations display an error message of some kind. SEE ALSO atexit() MENU

exit()

LIBRARIES

abs
int abs (int num)
HEADER stdlib.h

PURPOSE To convert the value passed to num

into its absolute value.

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (2 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

RESULT If successful abs() returns the absolute value of the integer num, otherwise the value returned is implementation defined. NOTES An absolute value can be any NON negative value including ZERO. SEE ALSO div() ldiv() , fabs() C99 MENU

, .
LIBRARIES

labs()

acos
double acos (double angle)
HEADER math.h into its arc cosine.

PURPOSE To convert the double precision value passed to angle

RESULT If successful, acos() returns the arc cosine of angle in radians, otherwise if the value returned by acos() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, acos() returns + or - HUGE_VAL, in either is set to ERANGE. case errno returns 0.0, but whether errno is set to ERANGE If the value is too small acos() is implementation defined. NOTES If the value contained within angle is neither a double number, nor between -1 and 1. A domain error (an illegal argument) will occur, the global integer errno set to EDOM, and an implementation defined value returned. SEE ALSO asin() atan2() sin() , tanh()

, , sinh() C99 cos()

atan() , , . tan()

, cosh() ,

MENU

LIBRARIES

asctime
char *asctime (const struct tm *currtime)
HEADER time.h

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (3 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

PURPOSE To obtain the current date, in the form of weekday, month, day of the month, hour, minutes, seconds, year. This is then placed into a string 26 characters long. RESULT If successful, asctime() returns a pointer to the buffer where the character string has been stored, otherwise the value it returns is implementation defined. NOTES Each time either asctime() , or ctime() stored within the string may be overwritten. pointed to by To initialise the tm structure currtime , either localtime() gmtime() must be called. The tm structure

is called, information , or

contains at least the following members in any order:

int tm_sec int tm_min int tm_hour int tm_mday int tm_month int tm_year int tm_wday

the number of seconds the number of minutes the number of hours the day of the month

(0,60) (0,59) (0,23) (1,31)

the number of months since January

(0,11)

the number of years since 1900 the number of days since Sunday the number of days since January 1st

(0,99) (0,6)

int tm_yday

(0,365)

int tm_isdst
If the value of tm_isdst time indicator is switched on. Or if the value of tm_isdst If the value of tm_isdst

the daylight savings time indicator

is GREATER than or EQUAL to 1, the daylight savings is ZERO then the indicator is switched off. is negative the indicator is not being used.

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (4 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

SEE ALSO clock(), difftime(), time(). MENU LIBRARIES

asin
double asin (double angle) HEADER math.h

PURPOSE To convert the double precision value passed to angle into its arc sine. RESULT If successful, asin() returns the arc sine of angle, in radians, otherwise if the value returned by asin() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, asin() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small asin() returns 0.0, but whether errno is set to ERANGE is implementation defined. NOTES If the value contained within angle is neither a double number, nor between -1 and 1. A domain error (a illegal argument) will occur, the global integer errno set to EDOM, and an implementation defined value returned. SEE ALSO acos(), atan(), atan2(), cos(), cosh(), sin(), sinh(), tan(), tanh(), C99. MENU LIBRARIES

assert
void assert (int comparison) HEADER assert.h

PURPOSE To help track down errors of logic within a program. RESULT No values are returned by this function. NOTES assert() is implemented as a macro not a function. If the assert() macro is replaced by a function, the behavior of that function is undefined. If the result of the comparison is ZERO, assert() generates an implementation defined error message. Showing the predefined macros _FILE_ (the name of the file), and _LINE_ (the line where the error occurred), together with the values contained within comparison. Following this it calls abort().
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (5 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

Otherwise assert() will allow the program to continue. If you wish to switch assert() off, after the program has been tested for bugs, #define the macro NDEBUG. SEE ALSO raise(), signal(). MENU LIBRARIES

atan
double atan (double angle) HEADER math.h

PURPOSE To convert the double precision value passed to angle into its arc tangent. RESULT atan() returns the arc tangent of angle, in radians, otherwise if the value returned by atan() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, atan() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small atan() returns 0.0, but whether errno is set to ERANGE is implementation defined. NOTES If the value contained within angle is not a double value, a domain error (an illegal argument) will occur, the global integer errno set to EDOM, and an implementation defined value returned. SEE ALSO acos(), asin(), atan2(), cos(), cosh(), sin(), sinh(), tan(), tanh(), C99. MENU LIBRARIES

atan2
double atan2 (double first, double second) HEADER math.h

PURPOSE To calculate the value of the arc tangent of first divided by second, using the signs of both arguments to calculate its quadrant. RESULT If successful, atan2() returns the value of the arc tangent in radians, otherwise if the value returned by atan2() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, atan2() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small atan2() returns 0.0, but whether errno is set to ERANGE is implementation defined. NOTES If the values of both first and second do not contain double precision numbers, or contain ZERO. A domain error (an illegal argument) will occur, the global integer errno set to EDOM, and an implementation defined
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (6 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

value returned. SEE ALSO acos(), asin(), atan(), cos(), cosh(), sin(), sinh(), tan(), tanh(), C99. MENU LIBRARIES

atexit
int atexit (void(*func)(void)) HEADER stdlib.h

PURPOSE The function pointed to by func(), will be called when the program terminates normally. RESULT atexit() returns ZERO if the function exists and can be nominated. Otherwise a NON ZERO value is returned. NOTES ANSI allows a minimum of 32 termination functions to be nominated. They are called in reverse order by exit(), these functions cannot have parameters.

SEE ALSO abort(), getenv(), system(). MENU LIBRARIES

atof
double atof (const char *string) HEADER PURPOSE To convert the character array pointed to by string into a double precision value. RESULT If successful, atof() returns a double value. Otherwise its behavior is implementation defined, it does not have to change the value of the global integer errno. NOTES If *string does not contain a floating point number, the value returned cannot be used. The character array must contain the following in this order:[WHITE SPACE SIGN] INTEGER DECIMAL POINT INTEGER [d,D,e,E SIGN INTEGER] stdlib.h

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (7 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

A WHITE SPACE consists of an optional space and or a tab character, which are both ignored. SIGN is either + or -, and is also optional. INTEGER may contain one or more decimal numbers.

If no numbers appear before the DECIMAL POINT then at least one must appear after it. The numbers may be followed by an exponent, which consists of an introductory letter, either d, D, e, or E and an optional signed integer. The character array will be processed by atof(), until the function reaches a character which it doesn't recognize, this includes `\0`. SEE ALSO atoi(), atol(), strtod(), strtol(), strtoul(). MENU LIBRARIES

atoi
int atoi (const char *string) HEADER stdlib.h

PURPOSE To convert the contents of the character array, pointed to by string into an integer value. RESULT If successful, atoi() returns an integer value. Otherwise its behavior is implementation defined, it does not have to change the value of the global integer errno. NOTES The character array pointed to by string must contain the following in this order:[WHITE SPACE SIGN] INTEGER

A WHITE SPACE consists of an optional space and or a tab character, which are both ignored. SIGN is either + or -, and is also optional. INTEGER may contain one or more decimal numbers.

The character array is processed by atoi() until the function reaches a character which it does not recognise , this includes `\0`. atoi() does not recognise decimal points or exponents. SEE ALSO atof(), atol(), strtod(), strtol(), strtoul(). MENU LIBRARIES

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (8 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

atol
long int atol (const char *string) HEADER stdlib.h

PURPOSE To convert the character array pointed to by string into a long integer. RESULT If atol() returns a long integer. Otherwise its behavior is implementation defined, it does not have to change the value of the global integer errno. NOTES The character array pointed to by string must contain a long integer value, and take the form:[WHITE SPACE SIGN] LONG INTEGER

A WHITE SPACE consists of an optional space and or a tab character, which are both ignored. SIGN is either + or -, and is also optional. INTEGER may contain one or more decimal numbers. The character array will then be processed by atol() until the function reaches a character which it doesn't recognise, this includes `\0`. atol() does not recognise decimal points or exponents. SEE ALSO atof(), atoi(), strtod(), strtol(), strtoul(). MENU LIBRARIES

bsearch
void *bsearch (const void *key1, const void *buffer, size_t length, size_t width, int (*compare) (const void *key2, const void *elem)) HEADER stdlib.h

PURPOSE To perform a binary search on the sorted array pointed to by buffer, until a match is found with the character pointed to by key1. Where length is the number of array elements, and width the size in bytes of each element. compare points to a user defined function, which carries out the actual comparison. key2 points to the same character pointed to by key1 within bsearch(), while elem points to an individual element within the sorted array. RESULT If successful, bsearch() itself returns a generic pointer, containing the address of the first match with *key2, otherwise it
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (9 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

returns the macro NULL (a NULL pointer). The user defined function pointed to by compare is called at least once by bsearch(). Each time (*compare ()) tests the value within the array element pointed to by elem, to check whether it matches the value pointed to by key2. It must return one of the following three values:-

Less than ZERO

If *key2

is less than *elem

ZERO

If *key2

is equal to *elem

More than ZERO

If *key2 *elem

is greater than

NOTES The array being searched must be sorted in ascending order, with the lowest array element containing the lowest value. It must not contain duplicate records with identical keys. SEE ALSO qsort(). MENU LIBRARIES

calloc
void *calloc (size_t num, size_t length) HEADER stdlib.h

PURPOSE To allocate an area of memory for an array of elements. Where num is the number of individual elements and length their size in bytes. RESULT If successful, calloc() returns a generic pointer to the beginning of the area of memory allocated. Otherwise it returns the macro NULL (a NULL pointer). NOTES Unlike malloc(), calloc()initialises all the bits within the array to ZERO. SEE ALSO free(), realloc(). MENU LIBRARIES

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (10 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

ceil
double ceil (double upwards) HEADER math.h

PURPOSE To calculate the double precision value passed to upwards, rounded up to its next whole number. RESULT If successful ceil() returns a double value, rounded up to the next whole number, otherwise if the value returned by ceil() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, ceil() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small ceil() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES If the value contained within upwards is not a double. A domain error (an illegal argument) will occur, and the global integer errno set to EDOM. SEE ALSO fabs(), floor(), fmod(). MENU LIBRARIES

clearerr
void clearerr (FILE *file_pointer) HEADER stdio.h

PURPOSE To switch the file error flag off, and to reset the End Of File indicator associated with the file pointed to by file_pointer. RESULT No values are returned by this function. SEE ALSO feof(), ferror(), fgetpos(), ftell(), fseek(), fsetpos(), perror(), rewind(). MENU LIBRARIES

clock
clock_t clock (void) HEADER PURPOSE
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (11 of 63) [21-06-2008 18:24:36]

time.h

A Dictionary of ANSI Standard C Function Definitions

To find out how long a distinct process within a program has been running. RESULT If successful, clock() returns the amount of time the entire program has been running, as an variable of type clock_t, otherwise it returns (clock_t)-1. NOTES To convert the value returned by clock() into seconds divide it by the macro CLOCKS_PER_SEC. SEE ALSO asctime(), ctime(), difftime(), gmtime(), localtime(), mktime(), strftime(), time(). MENU LIBRARIES

cos
double cos (double angle) HEADER math.h

PURPOSE To convert the double precision value passed to angle into its cosine. RESULT If successful, cos() returns the cosine of angle, in radians, otherwise if the value returned by cos() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, cos() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small cos() returns 0.0, but whether errno is set to ERANGE is implementation defined. NOTES If the value contained within angle is not a double number, a domain error (an illegal argument) will occur, the global integer errno set to EDOM, and an implementation defined value returned. SEE ALSO acos(), asin(), atan(),atan2(), cosh(), sin(), sinh(), tan(), tanh(), C99. MENU LIBRARIES

cosh
double cosh (double angle) HEADER math.h

PURPOSE To convert the double precision value passed to angle into its hyperbolic cosine. RESULT If successful, cosh() returns the hyperbolic cosine of angle, in radians, otherwise if the value returned by cosh() is not a double, a range error (an illegal return value) will occur.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (12 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

Or if the value is too large to fit inside a double, cosh() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small cosh() returns 0.0, but whether errno is set to ERANGE is implementation defined. NOTES If the value contained within angle is not a double number, a domain error (an illegal argument) will occur, the global integer errno set to EDOM, and an implementation defined value returned. . SEE ALSO acos(), asin(), atan(), atan2(), cos(), sin(), sinh(), tan(), tanh(), C99. MENU LIBRARIES

ctime
char *ctime (const time_t *num_seconds) HEADER time.h

PURPOSE To obtain the local time in the form of weekday, month, day of month, year, hours, minutes, seconds. Which is placed in a string 26 characters long. RESULT If successful, ctime() returns a pointer to the buffer, where the character string has been stored, otherwise it returns an implementation defined value. NOTES Before calling ctime() num_seconds, a pointer to the calendar time, must be obtained by calling time(). The calendar time is stored as a object of type time_t, containing an implementation defined variable. Each time either asctime(), or ctime() , is called, information stored within the string may be overwritten. SEE ALSO clock(), difftime(). MENU LIBRARIES

difftime
double difftime (time_t end, time_t begin) HEADER time.h

PURPOSE To calculate the difference in seconds between the value passed to end (the end of a period of time), and that passed to begin (the beginning). RESULT If successful, difftime() returns a double precision value, containing the time difference in seconds. NOTES
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (13 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

time_t is an object which stores time as an implementation defined variable. The values contained within begin and end can be obtained by calling clock() on two separate occasions. SEE ALSO asctime(), clock(), ctime(), gmtime(), localtime(), mktime(), strftime(), time(). MENU LIBRARIES

div
div_t div (int number, int divider) HEADER stdlib.h

PURPOSE To divide the value passed to number, by the value contained in divider. RESULT If successful, div() returns a div_t structure containing both the quotient, and the remainder of the division as two separate values, otherwise the value returned is implementation defined.. NOTES If the value contained in divider is ZERO, the behavior is implementation defined. However, many implementations terminate with an error message. The div_t structure contains the following members, although they do not have to appear in that order: typedef struct { int quot; int rem; } div_t div SEE ALSO abs(), labs(), ldiv() MENU LIBRARIES

exit
void exit (int exit_code) HEADER stdlib.h

PURPOSE To terminate the program which calls it. RESULT No values are returned by this function. NOTES exit() can be executed only once within a program.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (14 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

If the value passed to exit_code is ZERO or EXIT_SUCCESS then the program has terminated normally, any other implementation defined value indicates an error of some kind. The other macro used by exit_code is EXIT_FALSE . When exit() is called any functions nominated by atexit() will be called in their reverse order. Any files which are still open will be closed, after the buffers linked to them have been emptied. All temporary files created by tmpfile() are deleted. SEE ALSO abort(), MENU LIBRARIES

exp
double exp (double num) HEADER math.h

PURPOSE To calculate the natural logarithm e, raised to the power of num. RESULT If successful, exp() returns a double precision value containing e to the power of num, otherwise if the value returned by exp () is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, exp() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small exp() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES If the value contained within num is not a double, a domain error (an illegal argument) will occur, and the global integer errno set to EDOM. SEE ALSO log, C99 . MENU LIBRARIES

fabs
double fabs (double num) HEADER math.h

PURPOSE To calculate the absolute (e.g positive) value of num. RESULT If successful fabs() returns the absolute value of num as a double precision number, otherwise if the value returned by fabs() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, fabs() returns + or - HUGE_VAL, in either case errno is set to ERANGE.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (15 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

If the value is too small fabs() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES The absolute value of a number can only be positive. If the value contained within num is not a double, a domain error (an illegal argument) will occur, and the global integer errno set to EDOM. SEE ALSO abs(), ceil(), floor(), fmod(), labs(). MENU LIBRARIES

fclose
int fclose (FILE *file_pointer) HEADER stdio.h

PURPOSE To close the file pointed to by file_pointer. RESULT If successful, fclose() will return ZERO. Otherwise it returns EOF. NOTES Information in the buffer pointed to by file_pointer will be emptied, and its contents flushed to that particular file. However, data which is waiting to be read will be discarded. SEE ALSO fflush(), fopen(), freopen(). MENU LIBRARIES

feof
int feof (FILE *file_pointer) HEADER stdio.h

PURPOSE To check whether the end of the file pointed to by file_pointer has been reached. RESULT If the The End Of File indicator has been set, feof() will return NON ZERO . Otherwise it returns ZERO. NOTES feof() is often used when working with binary files. Calling clearerr(), fseek(), fsetpos(), or rewind() will clear the EOF indicator.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (16 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

SEE ALSO ferror(), perror(). MENU LIBRARIES

ferror
int ferror (FILE *file_pointer) HEADER stdio.h

PURPOSE To check for read/write errors in the file pointed to by file_pointer. RESULT If an error has been detected ferror() will return NON ZERO. NOTES Those error flags linked to file_pointer will remain set until either fclose(), rewind(), or clearerr() are called. ferror() is often used when checking for errors in binary files. SEE ALSO feof(), perror(). MENU LIBRARIES

fflush
int fflush (FILE *file_pointer) HEADER stdio.h

PURPOSE To empty the contents of the output buffer, into the file pointed to by file_pointer. RESULT If successful, fflush() returns ZERO, otherwise it returns EOF. NOTES To flush ALL output buffers call fflush(NULL). If the file has been opened for read/write, a read may not be followed by a write. Or vice versa, without first calling either fflush(), fseek(), fsetpos(), or rewind(). SEE ALSO fclose(), fopen(), freopen(), setbuf(), setvbuf(). MENU LIBRARIES

fgetc
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (17 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

int fgetc (FILE *file_pointer) HEADER stdio.h

PURPOSE To obtain the next character from the file pointed to by file_pointer, and increment the file position indicator. RESULT If successful, fgetc() will return the numerical value of the character read. Otherwise it will return EOF. NOTES fgetc() will also return EOF in the event of a read error. When working with binary files, feof() must be called, to check that the End Of File position has been reached, and ferror() to check for errors. If the file has been opened for read/write, a read may not be followed by a write. Or vice versa, without first calling either fflush(), fseek(), fsetpos(), or rewind(), unless EOF was the last character read by fread() SEE ALSO fgets(), fputc(), fputs(), fwrite(), getc(), getchar(), gets(), putc(), putchar(), puts(). MENU LIBRARIES

fgetpos
int fgetpos (FILE *file_pointer, fpos_t *position) HEADER stdio.h

PURPOSE To obtain the location of the file position indicator linked to *file_pointer, this value will then be stored in the area of memory pointed to by position. RESULT If successful, fgetpos() will return ZERO, otherwise it returns NON ZERO storing an implementation defined positive value in the global integer errno. NOTES The information stored in position can be used later by fsetpos() to return the file position indicator to its former location. SEE ALSO fflush(), fseek(), ftell(), rewind(), C99 . MENU LIBRARIES

fgets
char *fgets (char *string, int width, FILE *file_pointer)
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (18 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

HEADER

stdio.h

PURPOSE To read a line of width - 1 number of characters long into the buffer pointed to by string, from the file pointed to by file_pointer. RESULT If successful, fgets() will return the address of the input buffer, otherwise it returns the macro NULL (a NULL pointer). NOTES fgets() will continue to read characters until either the '\n' or EOF character is received. If the length of the line of characters is less than width, the '\n' character will be copied into *string. At the end of the string an '\0' character is added. To check whether an error has occurred or the EOF character has been reached, either feof() or ferror() needs to be called. SEE ALSO fgetc(), fputc(), fread(), fwrite(), getc(), getchar(), gets(), putc(), putchar(), puts(), C99 . MENU LIBRARIES

floor
double floor (double lower) HEADER math.h

PURPOSE To round the double precision value passed to lower, down to its next whole number. RESULT If successful floor() returns a double value rounded down to its nearest whole number, otherwise if the value returned by floor () is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, floor() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small floor() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES If the value contained within lower is not a double a domain error (an illegal argument) will occur, and the global integer errno set to EDOM. SEE ALSO ceil(), fabs(), fmod(). MENU LIBRARIES

fmod
double fmod (double first, double second) HEADER math.h

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (19 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

PURPOSE To calculate the remainder of first divided by second. RESULT If successful fmod() returns a positive double precision value that is less than the value of second, otherwise if the value returned by fmod() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, fmod() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small fmod() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES If the values of both first and second do not contain double precision numbers, a domain error (an illegal argument) will occur, and the global integer errno set to EDOM. If the value of second is ZERO, whether a domain error occurs or fmod() returns 0.0 is implementation defined. SEE ALSO ceil(), fabs(), floor(). MENU LIBRARIES

fopen
FILE *fopen (const char *file_name, const char *mode) HEADER stdio.h

PURPOSE To open the file, whose name is pointed to by file_name, where mode points to the type of access allowed. RESULT If successful, fopen() returns a pointer to the opened file. Otherwise it returns the macro NULL (a NULL pointer). NOTES Unless the length of *file_name is implementation defined, FILENAME_MAX will be the recommended size of the array. The macro FOPEN_MAX determines the number of files that a program may have open at the same time, under MSDOS this will be at least eight. Since three are always assigned to stdin (standard input), stdout (standard output), and stderr (standard error), that leaves five. However, these three can if necessary be reassigned using freopen(). If the file has been opened for read/write, a read may not be followed by a write. Or vice versa, without first calling either fflush(), fseek(), fsetpos(), or rewind(). Unless EOF was the last character read by fread(). The parameter pointed to by mode must contain one of the following values:

"a"

Open a text file for writing, create one if it does not already exist, append to the bottom of the file.

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (20 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

"a+"

Open a text file for reading and writing, create one if it does not already exist, append to the bottom of the file.

"ab"

Open a binary file for writing, create one if it does not already exist, append to the bottom of a file.

"ab+"

Open a binary file for reading and writing, create one if it does not already exist, append to the bottom of the file.

"r"

Open a text file, if it already exists for reading

"r+"

Open a text file, for reading and writing, if it already exists erase the contents.

"rb"

Open a binary file, if it already exists for reading.

"rb+"

Open a binary file, for reading and writing, if it already exists erase the contents.

"w"

Open a text file for writing, if it already exists erase the contents, otherwise create one.

"w+"

Open a text file for reading and writing, if it already exists erase the contents.

"wb"

Open a binary file for writing, if it already exists erase the contents.

"wb+"

Open a binary file for reading and writing, if it already exists erase the contents.

SEE ALSO fclose(), ftell(), fgetpos(), C99 . MENU LIBRARIES

fprintf
int fprintf (FILE *file_pointer, const char *format, [argument], ...) HEADER stdio.h

PURPOSE To write a series of alphanumeric or printable characters to the file pointed to by file_pointer. Where format points to the type of alphanumeric or printable character or characters, which will be contained in argument,
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (21 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

and '...' indicates a variable number of arguments. RESULT If successful, fprintf returns the number of characters that have been written to the file, otherwise a negative value is returned. A minimum of 509 characters can be written at any one time. NOTES The rules that apply to *format are the same as for printf(). SEE ALSO fscanf(), scanf(), sprintf(), sscanf(), vfprintf(), vprintf(), vsprintf() C99 MENU LIBRARIES

fputc
int fputc (int ch, FILE *file_pointer) HEADER stdio.h

PURPOSE To write a character to the file pointed to by file_pointer, and increment its file position indicator. RESULT If successful, fputc() returns a positive value corresponding to the character written, otherwise it returns EOF. NOTES This function performs the same action as putc(). However, fputc() is more likely to be a function, not a macro. Use ferror() to check whether an error has occurred. The value passed to ch is converted by fputc() into an unsigned char. If no file position indicator exists, the character is appended to the end of the file. SEE ALSO fgetc(), fgets(), fputs(), getc(), getchar(), gets(), putchar(), puts(), ungetc(). MENU LIBRARIES

fputs
int fputs (const char *string, FILE *file_pointer) HEADER stdio.h

PURPOSE To write the character array pointed to by string, into the file pointed to by file_pointer. RESULT If successful, fputs() returns a positive value. Otherwise it returns EOF.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (22 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

NOTES An '\n' character at the end of the string will not be written to the file. SEE ALSO fgetc(), fgets(), fputc(), getc(), getchar(), gets(), putc(), putchar(), puts(), ungetc(), C99 . MENU LIBRARIES

fread
size_t fread (void *buffer, size_t width, size_t count, FILE *file_pointer) HEADER stdio.h

PURPOSE To read a group or groups of variables from a file pointed to by file_pointer, into the array pointed to by buffer. Where count is the number of groups is to be read, and width their length in bytes. RESULT If successful, fread() returns the number of groups read, and increments the file position indicator, otherwise it returns ZERO. NOTES If the file pointed to by file_pointer is in text mode, all carriage return line feed characters will be replaced by single line feed characters. If the file has been opened for read/write, a read may not be followed by a write, or vice versa, without first calling either fflush(), fseek(), fsetpos(),or rewind(). Unless EOF was the last character read by fread(). SEE ALSO fwrite(), fgetpos(), ftell(), C99 . MENU LIBRARIES

free
void free (void *memory_ptr) HEADER stdlib.h

PURPOSE To free an area of memory. RESULT No values are returned by this function. NOTES Before calling free() the area of memory pointed to by memory_ptr, must have been assigned by calling either calloc(), malloc(), or realloc(). If the value contained in memory_ptr is the value NULL (a NULL pointer) no action occurs.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (23 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

MENU

LIBRARIES

freopen
FILE *freopen (const char *new_file, const char *mode, FILE *file_pointer) HEADER stdio.h

PURPOSE To close the file, whose name is pointed to by file_pointer, which is then reassigned to another file. Where new_file points to the name of the new file, and mode the file access mode. RESULT If successful, freopen() returns the address of the new file, otherwise it returns the macro NULL (a NULL pointer). NOTES Unless the length of *new_file is implementation defined, FILENAME_MAX will be the recommended size of the array. See fopen() for a complete description of *mode. freopen() can be used to redirect stderr (standard error device), stdin (standard input device), and stdout (standard output device), to files on disk or to other devices. freopen() clears the error and end of file indicators, linked to file_pointer. SEE ALSO fclose(), fflush(), setbuf(), setvbuf(), C99 . MENU LIBRARIES

frexp
double frexp (double num, int *exp) HEADER math.h

PURPOSE To convert the value passed to num into its mantissa,within the range of 0.5 to 0.999. RESULT If successful frexp() returns the mantissa of num, and stores the exponent in the integer pointed to by exp, otherwise if the value returned by frexp() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double,frexp() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small, or num equals ZERO, frexp() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES If the values passed to frexp are not, a double precision number and an integer, in that order. A domain error (an illegal argument) will result, and the global integer errno set to EDOM. If num contains ZERO, frexp() will return ZERO, and store ZERO in *exp.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (24 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

SEE ALSO exp(), ldexp(), log(), log10(), modf(). MENU LIBRARIES

fscanf
int fscanf (FILE *file_pointer, const char *format, [argument],...) HEADER stdio.h

PURPOSE To read information from the file pointed to by file_pointer, into the areas of memory specified by argument. Where argument contains the addresses of those memory areas, *format describes the type of alphanumeric or printable characters contained in argument, and '... 'indicates a variable number of arguments. RESULT If is successful, fscanf() returns the number of groups of variables that have been read. Otherwise it returns EOF in the case of an error, or ZERO if none were read. To check whether the EOF character has been reached, call either feof() or ferror(). NOTES See scanf() for a complete description of *format. SEE ALSO fprintf(), printf(), sprintf(), sscanf(), vfprintf(), vprintf(),vsprintf(), C99 . MENU LIBRARIES

fseek
int fseek (FILE *file_pointer, long int offset, int start_point) HEADER stdio.h

PURPOSE To reset the file position indicator, within the file pointed to by file_pointer. Where offset is the number of bytes that need to be added to start_point, the current position of that indicator. RESULT If successful, fseek() returns ZERO. Otherwise it returns a NON ZERO value. NOTES fseek() supports random input/output operations, and will reset the End Of File indicator. start_point must contain one of the following constants:SEEK_CUR SEEK_END seek from the current file position seek from the End Of File

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (25 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

SEEK_SET

seek from the beginning of the file may not always work with binary files.

SEEK_END -

The carriage return line feed characters contained within text files will cause results to be unpredictable. When using text files the value contained within offset, should be either 0L or returned by ftell(). If ungetc() has been called immediately before fseek() any action it has caused will be ignored. If the file has been opened for read/write, a read may not be followed by a write. Or vice versa, without first calling either fflush(), fseek(), fsetpos(), or rewind().

SEE ALSO fgetpos(), fread(), fwrite(). MENU LIBRARIES

fsetpos
int fsetpos (FILE *file_pointer, const fpos_t *position) HEADER stdio.h

PURPOSE To move the file position indicator pointed to by file_pointer, to the location pointed to by position. RESULT If successful, fsetpos() returns ZERO, and resets the End Of File indicator. Otherwise it returns a NON ZERO value, and stores an implementation defined positive number in the global integer errno. NOTES The value pointed to by position must be obtained by calling fgetpos(), . If the file has been opened for read/write, a read may not be followed by a write. Or vice versa, without first calling either fflush(), fseek(), fsetpos(), or rewind(). fsetpos() undoes the work of ungetc(). SEE ALSO fread(), fwrite(), ftell(). MENU LIBRARIES

ftell
long int ftell (FILE *file_pointer) HEADER stdlib.h

PURPOSE To obtain the location of the file position indicator pointed to by file_pointer, in bytes from the beginning of the file.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (26 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

RESULT If successful, ftell() returns the location of the file position indicator, as an offset in relation to the beginning of the file. Otherwise it returns the -1L, and stores an implementation defined positive value in the global integer errno. NOTES When using text files the long value returned by ftell(),should be used with fseek(). SEE ALSO fread(), fwrite(), fgetpos(), fsetpos(), rewind(). MENU LIBRARIES

fwrite
size_t fwrite (const void *buffer, size_t width, size_t count, FILE *file_pointer) HEADER stdio.h

PURPOSE To increment the file position indicator and write groups of variables to the file pointed to by file_pointer, from the character array pointed to by buffer. Where count is the number of groups being written, and width is the length of an individual group in bytes. RESULT If successful fwrite() returns the number of groups written to the file. In the event of an error this value will be less than count. NOTES If the file has been opened for read/write, a read may not be followed by a write. Or vice versa, without first calling either fflush(), fseek(), fsetpos(), or rewind(). Unless EOF was the last character read by fread(). SEE ALSO fgetpos(), C99 . MENU LIBRARIES

getc
int getc (FILE *file_pointer) HEADER stdio.h

PURPOSE To read a character from the file pointed to by file_pointer. RESULT If successful, getc() returns the numerical value of the character read, otherwise it returns EOF.

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (27 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

NOTES getc() may be implemented by a macro using fgetc(). Use feof() or ferror() to check whether the End Of the File has been reached or an error has occurred. If the file has been opened for read/write, a read may not be followed by a write. Or vice versa, without first calling either fflush(), fseek(), fsetpos(), or rewind(). Unless EOF was the last character read by fread() SEE ALSO fgets(), fputc(), fputs(), getchar(), gets(), putc(), putchar(), puts(), ungetc(). MENU LIBRARIES

getchar
int getchar (void) HEADER stdio.h

PURPOSE To read a character from stdin (the standard input device), usually after the enter key has been pressed. RESULT If successful, getchar() returns the numerical value of the character read, otherwise it returns EOF. NOTES getchar() does not display the character it has received on the screen, and may be implemented by a macro using getc(). Use ferror() or feof() to check whether an error has occurred, or the End Of File has been reached. SEE ALSO fgetc(), fgets(), fputc(), fputs(), getc(), gets(), putc(), putchar(), puts(), ungetc(). MENU LIBRARIES

getenv
char *getenv (const char *env_name) HEADER stdlib.h

PURPOSE To obtain specific information relating to file directories, contained in the environment list provided by the host environment, whose entry title matches the string pointed to by env_name. RESULT If successful getenv() returns a pointer to the environment list entry, otherwise it returns the macro NULL (a NULL pointer). NOTES The string pointed to by env_name may be overwritten the next time getenv() is called.

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (28 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

SEE ALSO atexit(), exit(), system(). MENU LIBRARIES

gets
char *gets (char *string) HEADER stdio.h

PURPOSE To read a string from stdin (the standard input device), into the character array pointed to by string. RESULT If successful, gets() returns a pointer to the character array. Otherwise it will return the macro NULL (a NULL pointer), when an error has occurred or the EOF character has been received. NOTES gets() will read the string until it receives either an '\n', or EOF character, when that happens the array is terminated by an '\0'. For that reason it is not recommended that you use this function with INTERNET programs, use fgets() instead. Use feof() or ferror() to check whether the EOF character has been received. SEE ALSO fgetc(), fputc(), fputs(), getc(), getchar(), putc(), putchar(), puts(), ungetc(). MENU LIBRARIES

gmtime
struct tm *gmtime (const time_t *num_seconds) HEADER time.h

PURPOSE To convert the calendar time pointed to by num_seconds, into Coordinated Universal Time (UTC). This information is then stored within a tm structure. RESULT If successful gmtime() returns a pointer to a tm structure, otherwise it returns the macro NULL (a NULL pointer). NOTES To initialise num_seconds, the function time() must be called. When using either MSDOS or OS/2, dates before 1980 may cause gmtime() to return NULL. Each time asctime(), ctime(), gmtime(), or localtime() is called, information contained within the tm structure may be overwritten. The object time_t stores time as an implementation defined variable. SEE ALSO clock(), difftime(), time()
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (29 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

MENU

LIBRARIES

isalnum
int isalnum (int letter_number) HEADER ctype.h

PURPOSE To check whether the value passed to letter_number is alphanumeric. RESULT If successful, isalnum() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), C99. MENU LIBRARIES

isalpha
int isalpha (int letter) HEADER ctype.h

PURPOSE To check whether the value passed to letter is alphabetic, e.g. an implementation defined character, that is neither a control character, a digit, a punctuation character, or a space.. RESULT If successful, isalpha() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), C99. MENU LIBRARIES

iscntrl
int iscntrl (int control_delete) HEADER PURPOSE
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (30 of 63) [21-06-2008 18:24:36]

ctype.h

A Dictionary of ANSI Standard C Function Definitions

To check whether the value passed to control_delete, is either a control character (e.g an implementation defined character that is not printable) or the delete character. RESULT If successful, iscntrl() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), C99. MENU LIBRARIES

isdigit
int isdigit (int num) HEADER ctype.h

PURPOSE To check whether the value passed to num is a digit between 0 and 9. RESULT If successful, isdigit() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), iscntrl(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), C99. MENU LIBRARIES

isgraph
int isgraph (int print) HEADER ctype.h

PURPOSE To check whether the value passed to print, is any printable character (e.g. an implementation defined character which can be displayed) other than a space. RESULT If successful, isgraph() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), C99. MENU LIBRARIES

islower
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (31 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

int islower (int ch) HEADER ctype.h

PURPOSE To check, when using the 'C' locale, whether the value passed to ch is a lower case letter. RESULT If successful, islower() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), ispunct(), isspace(), isupper(), isxdigit(), C99. MENU LIBRARIES

isprint
int isprint (int print) HEADER ctype.h

PURPOSE To check whether the value passed to print, is a printable character (e.g an implementation defined character that can be displayed) or a space. RESULT If successful, isprint() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), ispunct(), isspace(), isupper(), isxdigit(), C99. MENU LIBRARIES

ispunct
int ispunct (int comma) HEADER ctype.h

PURPOSE To check whether the value passed to comma is a punctuation character. In other words ANY printable character which is neither alphanumeric, a control character, nor a space. RESULT If successful, ispunct() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), isspace(),
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (32 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

isupper(), isxdigit(), C99. MENU LIBRARIES

isspace
int isspace (int space) HEADER ctype.h

PURPOSE To check, when using the 'C' locale, whether the value passed to space is either:-

'

a space character

'\t'

a horizontal tab

'\v'

a vertical tab

'\f'

a form feed

'\r'

a carriage return

'\n'

a new line character

RESULT If successful, isspace() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct() isupper(), isxdigit(), C99 MENU LIBRARIES

isupper
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (33 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

int isupper (int ch) HEADER ctype.h

PURPOSE To check whether the value passed to ch is an upper case character. RESULT If successful, isupper() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), ispunct(), isspace(), isxdigit(), C99. MENU LIBRARIES

isxdigit
int isxdigit (int hex) HEADER ctype.h

PURPOSE To check whether the value passed to hex is either a hexadecimal digit, a decimal digit, or a letter between the ranges 'A' 'F', and 'a' - 'f'. RESULT If successful, isxdigit() returns a NON ZERO value, otherwise it returns ZERO. SEE ALSO isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isupper(), C99. MENU LIBRARIES

labs
long int labs (long int num) HEADER stdlib.h

PURPOSE To calculate the absolute (e.g. positive ) value of num. RESULT If successful labs() returns the absolute value of num, otherwise the value returned is implementation defined. NOTES The absolute value of a number can only be positive.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (34 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

SEE ALSO abs(), div(), fabs(), ldiv(). MENU LIBRARIES

ldexp
double ldexp (double num, int exp) HEADER math.h

PURPOSE To calculate the value of num, multiplied by 2 to the value contained within exp. RESULT If successful, ldexp() returns the value of num multiplied by 2 to the power of exp, otherwise if the value returned by ldexp() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, ldexp() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small ldexp() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES If the values passed to ldexp() are not a double precision number and an integer in that order, a domain error (an illegal return value) will result, and the global integer errno set to EDOM. SEE ALSO frexp(), modf(). MENU LIBRARIES

ldiv
ldiv_t ldiv (long int num, long int divisor) HEADER stdlib.h

PURPOSE To calculate the result and the remainder, after the division of num by divisor. RESULT If successful ldiv() returns the result quot, and the remainder rem, contained inside the ldiv_t structure. Otherwise the value returned is implementation defined. NOTES The contents of the ldiv_t structure are as follows, although they do not have to appear in that order: typedef struct { long quot; long rem; }
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (35 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

ldiv_t SEE ALSO div(). MENU LIBRARIES

localeconv
struct lconv *localeconv (void) HEADER locale.h

PURPOSE To initialise the structure lconv, with the numerical and monetary values of the current locale. RESULT localeconv() returns a pointer to the structure lconv. NOTES localeconv() is called before setlocale(), even though setlocale() can change the contents of the structure. The structure lconv contains the following:

char *decimal point char *thousands_sep char *grouping char *int_curr_symbol char *currency_symbol char *mon_decimal_point char *mon_thousands_sep char *mon_grouping

The decimal point character The character used to denote thousands The length of each group of numbers The International currency symbol consisting of 3 letters The local currency symbol used by that particular country or region The character used to represent the decimal point, when used with money

The character used to separate thousands, when used with money

The length of each group of numbers when used with money

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (36 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

char *positive_sign char *negative_sign

The plus sign The minus sign How many numbers are to be displayed after the decimal point, when used with international currency How many numbers are to be displayed after the decimal point, when used with local currency. Whether the currrency symbol comes before (1), or (0) after a sum of money. Whether the currency symbol is (1), separated by a space from a sum of money (otherwise 0). Whether the currency symbol comes before (1) or (0) after a negative sum of money. Whether the currency symbol is separated by a space (1), from a negative sum of money (otherwise 0). The position of the plus sign when used with currency. The position of the minus sign when used with currency.

char int_frac_digits

char frac_digits

char p_cs_precedes

char p_sep_by_space

char n_cs_precedes

char n_sep_by_space

char p_sign_posn char n_sign_posn

Both p_sign_posn and n_sign_posn use the following values: 0 Brackets surround the entire sum of money.

The sign is in front of both currency symbol and money.

The sign is behind both currency symbol and money.

The sign is in front of the currency symbol, wherever it appears.

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (37 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

The sign is behind the currency symbol, wherever it appears.

If any of the structure members contain the value CHAR_MAX they are not available in the locale being used. SEE ALSO mblen(), mbstowcs(), mbtowc(), wcstombs(), wctomb(). MENU LIBRARIES

localtime
struct tm *localtime (const time_t *num_seconds) HEADER time.h

PURPOSE To convert the calendar time pointed to by num_seconds into the local time zone, this information is stored within a tm structure. RESULT If successful localtime() returns a pointer to the tm structure, otherwise the value returned is implementation defined. NOTES Local time effects the time zone, and daylight savings time members of the tm structure. To initialise the pointer num_seconds, the function time() must be called. Each time ctime() , gmtime() , or localtime() is called, information within the tm structure may be overwritten. The object time_t stores time as an implementation defined variable. SEE ALSO clock(), difftime(), time(). MENU LIBRARIES

log
double log (double num) HEADER math.h

PURPOSE To calculate the natural logarithm of the value passed to num. RESULT If successful log() returns the natural logarithm of num, otherwise if the value returned by log() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, log() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small log() returns 0.0. When a domain error occurs, an implementation defined value is returned.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (38 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

NOTES If the value passed to num is not a double precision number or is negative, a domain error (an illegal argument) will occur, and the global integer errno is set to EDOM. SEE ALSO log10, C99. MENU LIBRARIES

log10
double log10 (double num) HEADER math.h

PURPOSE To calculate the base 10 logarithm for num. RESULT If successful log10() returns the base 10 logarithm of the value passed to num, otherwise if the value returned by log10() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, log10() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small log10() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES If the value passed to num is not a double precision number, or is negative, a domain error (an illegal argument) will occur, and the global integer errno is set to EDOM. SEE ALSO log(). MENU LIBRARIES

longjmp
void longjmp (jmp_buf stackinfo, int ret_value) HEADER setjmp.h

PURPOSE To enable the line of execution within a program to jump backwards from one function into another. Where stackinfo contains the information used to reset the stack, and ret_value the value returned by setjump() to the function which originally called it. RESULT No values are returned by this function. NOTES
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (39 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

In order to initialise stackinfo, setjmp() must be called before longjmp(). If after longjmp() has finished, the program is unable to move back to the statement following the call to setjmp() that defined stackinfo, errors may occur. Functions which control error handling, and program recovery, often use setjump(), and longjump(). MENU LIBRARIES

main
int main (void) or (int argc, char *argv[]) HEADER stdio.h

PURPOSE To provide a start point within a 'C' program, all other functions are called from inside main(). Information passed to the program through main() must use the following parameters: argc the number of items of information that are to be passed. *argv[] a pointer to an array of character pointers, normally the operating systems command line. RESULT main() can return the values EXIT_FAILURE or EXIT_SUCCESS once they have been passed by exit(). NOTES main() must NOT be called recursively, this means it must not be called more than once within the program. MENU LIBRARIES

malloc
void *malloc (size_t amount) HEADER stdlib.h

PURPOSE To allocate an area of memory from the heap, where amount is the memory size. RESULT If successful malloc() returns a generic pointer to the area of memory allocated, otherwise it returns the macro NULL (a NULL pointer). NOTES If malloc() does return NULL and it remains undetected, the system may crash. Unlike calloc(), areas of memory allocated by malloc() are not initialised to ZERO. SEE ALSO free(), realloc().
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (40 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

MENU

LIBRARIES

mblen
int mblen (const char *m_byte, size_t length) HEADER stdlib.h PURPOSE To calculate the number of bytes contained in a multibyte character, where length is the number of bytes in the array. RESULT If successful mblen() returns the exact number of bytes used to create the multibyte character in the string pointed to by m_byte. Otherwise it returns -1 in the case of an error during conversion where mblen() stores EILSEQ in errno . Or -2 if mblen() processed an incomplete multibyte character. If *m_byte is a NULL pointer mblen() may return either ZERO or NON ZERO depending on how the multibyte character was encoded. NOTES length cannot contain a value greater than MB_CUR_MAX. mblen() is effected by changes to the LC_CTYPE category of the current locale. SEE ALSO localeconv(), setlocale(), mbstowcs(), mbtowc(), wcstombs(), wctomb(). MENU LIBRARIES

mbstowcs
mbstowcs (wchar_t *w_string, const char *m_string, size_t length) HEADER stdlib.h PURPOSE To convert a series of multibyte characters contained in *m_string into wide characters, where length is the number of bytes within that array, and *w_string the array where they are stored. RESULT If successful mbstowcs() returns the number of characters converted, not including '\n', otherwise it returns -1. If *m_string contains a NULL pointer, mbstowcs() may return either ZERO or NON ZERO, depending on how the multibyte character was encoded. NOTES mbstowcs() terminates, either after length number of characters have been converted, or it reaches '\n'. length cannot contain a value greater than MB_CUR_MAX. wcstombs() is effected by changes to the LC_CTYPE category of the current locale. SEE ALSO localeconv(), setlocale(), mblen(), mbtowc(), wcstombs(), wctomb().
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (41 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

MENU

LIBRARIES

mbtowc
int mbtowc (wchar_t * w_ch, const char *m_byte, size_t length) HEADER stdlib.h PURPOSE To convert the multibyte character pointed to by m_byte into a wide character, whose length is the number of bytes within the array. RESULT If successful mbtowc() returns the exact number of bytes used to create the wide character and the value of that character is stored in * w_ch, Otherwise it returns -1 in the case of an error during conversion where mbtowc() stores EILSEQ inerrno. Or -2 if mbtowc() processed an incomplete multibyte character. If *m_byte is a NULL pointer mbtowc() may return either ZERO or NON ZERO depending on how the multibyte character was encoded. NOTES length cannot contain a value greater than MB_CUR_MAX. mbtowc() is effected by changes to the LC_CTYPE category of the current locale. SEE ALSO localeconv(), setlocale(), mblen(), mbstowcs(), wcstombs(), wctomb(). MENU LIBRARIES

memchr
void *memchr(const void *string, int ch, size_t count) HEADER string.h

PURPOSE To search the character array pointed to by string for the character passed to ch, where count is the length of that array. RESULT If successful, memchr() returns a generic pointer to the first array element containing ch, otherwise it returns the macro NULL (a NULL pointer). NOTES memchr() converts ch into an unsigned char. SEE ALSO memcmp(), memcpy(), memmove(), memset(),strchr(), strcspn(), strpbrk(), strrchr(), strspn(), strstr().
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (42 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

MENU

LIBRARIES

memcmp
int memcmp (const void *area1, const void *area2, size_t width) HEADER string.h

PURPOSE To compare the area of memory pointed to by area1, with the area of memory pointed to by area2. Both of which are at least width number of characters long. RESULT If successful memcmp() returns one of the following values:

Less than ZERO

If *area1

is less than *area2

ZERO

If *area1

is equal to *area2

Greater than ZERO

If *area1 *area2

is greater than

NOTES The characters within the two areas of memory are treated as unsigned char by memcmp(). SEE ALSO memchr(), memcpy(), memmove(), memset(), strcmp(), strncmp(), strcoll(). MENU LIBRARIES

memcpy
void *memcpy(void *to, const void *from, size_t width) HEADER string.h

PURPOSE To copy information from the area of memory pointed to by from, into the area of memory pointed to by to. Where width contains the length of the information in bytes. RESULT If successful memcpy() returns a generic pointer containing the destination address.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (43 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

NOTES Unlike memmove(), if areas of memory overlap, information may be overwritten before it is copied. SEE ALSO memchr(), memcmp(), memset(), strcpy(), strncpy(). MENU LIBRARIES

memmove
void *memmove (void *to, const void *from, size_t width) HEADER string.h

PURPOSE To copy information from the area of memory pointed to by from, into the area of memory pointed to by to. Where width contains the length of the information in bytes. RESULT If successful memmove() returns a generic pointer containing the destination address. NOTES Unlike memcpy(), memmove() will , if areas of memory overlap, copy information before it is overwritten. SEE ALSO memchr(), memcmp(), memset(), strcpy(), strncpy(). MENU LIBRARIES

memset
void *memset (void *buffer, int ch, size_t count) HEADER string.h

PURPOSE To copy the low order byte of the value passed to ch, into count number of elements of the array pointed to by buffer. RESULT If successful, memset() returns a generic pointer containing the address of *buffer. NOTES One of the common uses of memset(), is to initialise a region of memory to a known value. memset() converts ch to an unsigned char. SEE ALSO memchr(), memcmp(), memcpy(), memmove(). MENU LIBRARIES

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (44 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

mktime
time_t mktime (struct tm *local) HEADER time.h

PURPOSE To convert the local time contained within a tm structure into calendar time. RESULT If successful, mktime() returns the calendar time as a variable of type time_t. Otherwise it returns (time_t)-1. NOTES To initialise the tm structure, localtime() must be called first. The tm_wday and tm_yday members of the tm structure are changed by this function. When using either MSDOS or OS/2, dates before 1980 may cause mktime() to return (time_t)-1. an implementation defined variable. The object time_t stores time as SEE ALSO clock(), difftime(), time(). MENU LIBRARIES

modf
double modf (double num, double *whole) HEADER math.h

PURPOSE To convert the value passed to num into its whole number and fractional component parts. RESULT If successful modf() returns the signed fractional component of num, placing its whole number component into the double pointed to by whole, otherwise if the value returned by modf() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, modf() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small modf() returns 0.0. When a domain error occurs, an implementation defined value is returned. NOTES If the values passed to modf() are not double precision numbers, a domain error (an illegal argument) will occur setting the global integer errno to EDOM. SEE ALSO frexp(), ldexp(). MENU LIBRARIES

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (45 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

offsetof
size_t offsetof (structure_name, structure_member) HEADER stddef.h

PURPOSE A macro which measures the distance between structure_name, and structure_member. RESULT offsetof() is a macro which expands to an integral constant expression of type size_t, containing the number of bytes between the start point of structure_name, and the beginning of structure_member. NOTES If structure_member contains a bit-field, its behaviour is implementation defined. SEE ALSO sizeof MENU LIBRARIES

perror
void perror (const char *string) HEADER stdio.h

PURPOSE To send error messages to stderr (the standard error device). RESULT No values are returned by this function. NOTES Unless string contains the value NULL , or the character pointed to by string is '\0'. An appropriate error message will be displayed, consisting of text obtained from the character array *string, followed by ':', and whatever error message is linked to the global integer errno SEE ALSO clearerr(), feof(), ferror(), strerror(). MENU LIBRARIES

pow
double pow (double base, double exp) HEADER math.h

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (46 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

PURPOSE To calculate the value of base raised to the power of exp. RESULT If successful pow() returns the value of base raised to the power of exp, otherwise if the value returned by pow() is not a double, a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double, pow() returns + or - HUGE_VAL, in either case errno is set to ERANGE. If the value is too small pow() returns 0.0. NOTES If the values passed to pow() are not double precision numbers. Or if the value of base is ZERO, and the value of exp is less than or equal to ZERO. Or base contains a negative value, and exp is not an integer. Then a domain error (an illegal argument) will occur, and the global integer errno set to EDOM. When a domain error occurs, an implementation defined value is returned. Values greater than 2 to the power of 64 cannot be computed by pow(). SEE ALSO exp(), log(), log10(), sqrt(), C99. MENU LIBRARIES

printf
int printf (const char *format, [argument],...) HEADER stdio.h

PURPOSE To format and send printable characters to the standard output device (stdout), usually the video screen. Where *format defines the type of printable character contained in argument, which can be optional, and '...' indicates a flexible number of arguments. RESULT If successful printf returns the number of characters sent to stdout. Otherwise it returns a negative value. NOTES *format contains the text to be printed, optionally it can contain format tags that are substituted by the values specified in argument. These tags must be equal in number to the arguments used. *format may contain some or all of the following information in this order: % [MODIFIER] [WIDTH] [. PRECISION] [TAG] TEXT

MODIFIER

Specifies the type of character conversion or alignment

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (47 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

WIDTH

Minimum field width

PRECISION

Minimum number of digits to be displayed

TAG

Convert data into characters

TEXT

Character to be displayed, printed or stored

The following are a list of format identifiers which can be used with printf, and the variable types they display:

%c

A single unsigned character

%d

A signed decimal integer

%i

A signed decimal integer

%e

A floating point variable (exponent)

%E

A floating point variable (exponent)

%f

A floating point variable

%F

A floating point variable

%g

Allows system to choose either %e or %f

%G

Allows system to choose either %E or %F

%hd

A signed short integer

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (48 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

%hi

A signed short integer

%ho

An unsigned short integer (octal)

%hn

A short argument

%hu

An unsigned short integer

%hx

An unsigned short integer (hexadecimal lower case)

%hX

An unsigned short integer (hexadecimal upper case)

%ld

A signed long integer

%le

A double precision variable (exponent)

%lE

A double precision variable (exponent)

%lf

A double precision variable

%lF

A double precision variable

%lg

Allows system to choose either %le or %lf

% lG

Allows system to choose either %lE or %lF

%li

A signed long integer

%ln

A long argument

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (49 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

%lo

An unsigned long integer (octal)

%lu

An unsigned long integer

%lx

An unsigned long integer (hexadecimal lower case)

%lX

An unsigned long integer (hexadecimal lower case)

% Le

A long double precision variable (exponent)

% LE

A long double precision variable (exponent)

%Lf

A long double precision variable

%LF

A long double precision variable

% Lg

Allows system to choose either %Le or %Lf

%LG

Allows system to choose either %LE or %LF

%n

The number of characters written so far by printf ()

%p

A generic pointer (and its address)

%o

An unsigned integer (octal)

%s

A pointer to a character string

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (50 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

%u

An unsigned decimal integer

%x

An unsigned hexadecimal (lower case)

%X

An unsigned hexadecimal (upper case)

%%

The % sign

#e

Decimal point appears even when not needed

#f

Decimal point appears even when not needed

#g

Decimal point appears even when not needed

#x

Hexadecimal with ox prefix

\a

Alert

\b

Back space

\f

Form feed

\n

New line

\r

Carriage return

\t

Tab

\v

Vertical tab

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (51 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

\ooo

Up to three digit octal number

SEE ALSO fscanf(), fprintf(), scanf(), sscanf(), sprintf(), C99 . MENU LIBRARIES

putc
int putc (int ch, FILE *file_pointer) HEADER stdio.h

PURPOSE To write a character to the file pointed to by file_pointer. RESULT If successful putc() returns the numerical value of the character written to the file. Otherwise it returns EOF. NOTES Use ferror() to check for errors. putc() may also be implemented by a macro using fputc(). SEE ALSO fgetc(), fgets(), fputs(), getc(), getchar(), gets(), putchar(), puts(), ungetc(). MENU LIBRARIES

putchar
int putchar (int ch) HEADER stdio.h

PURPOSE To write a character to stdout (the standard output device), usually the video screen. RESULT If successful, putchar() returns the numerical value of the value written, otherwise it returns EOF. NOTES Use ferror() to check for errors, putchar() may also be implemented by a macro using fputc(). SEE ALSO fgetc(), fgets(), fputc(),fputs(), getc(), getchar(), gets(), putc(), puts(), ungetc(). MENU LIBRARIES

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (52 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

puts
int puts (const char *string) HEADER stdio.h

PURPOSE To write a string to stdout (the standard output device), usually the video screen. RESULT If sucessful puts() returns a positive value, otherwise it returns EOF. NOTES Use ferror() to check for errors. Unlike fputs(), puts() appends a new line to the output string. In other words whenever puts() encounters a '\0' character it replaces it with '\n'. SEE ALSO fgetc(), fgets(),, fputc(), getc(), getchar(), gets(), putc(), putchar(), ungetc(). MENU LIBRARIES

qsort
void qsort (void *buffer, size_t length, size_t width, int (*compare)( const void *key, const void *elem)) HEADER stdlib.h

PURPOSE To sort the array pointed to by buffer. Where length is the number of individual elements within the array, and width their size in bytes. compare points to a user defined function, which carries out the comparison. key and elem point to two separate elements within the array. RESULT No values are returned by qsort(). *compare() returns the following values:

Less than ZERO

If *key

is less than *elem

ZERO

If *key

is equal to *elem

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (53 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

MORE than ZERO

If *key

is greater than *elem

NOTES The array is be sorted in ascending order, with the lowest element containing the lowest value, what counts as the "lowest" depends on the values returned by *compare(). In other words the array could be sorted in descending order by reversing the values returned for greater than and less than. If some of the elements contain the same value, they will NOT be sorted properly. SEE ALSO bsearch(). MENU LIBRARIES

raise
int raise (int sig_num) HEADER signal.h

PURPOSE To cause a function previously installed by signal() to be called. Where sig_num, containing a value linked to that signal handler, is sent to the operating system. RESULT If successful raise() returns ZERO. Otherwise it returns a NON ZERO value. NOTES raise() may be used to check, whether functions installed by signal() are working correctly. Any signal handler called by raise(), must finish before raise() can return a value. SEE ALSO abort(), assert(), signal(). MENU LIBRARIES

rand
int rand (void) HEADER stdlib.h

PURPOSE To generate a sequence of pseudo random numbers, after srand() has been called. RESULT rand() returns a number between ZERO and RAND_MAX. The value of RAND_MAX must be at least 32767.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (54 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

MENU

LIBRARIES

realloc
void *realloc (void *memory_ptr, size_t new_size) HEADER stdlib.h

PURPOSE To change the amount of memory already allocated. Where memory_ptr points to an area of memory, previously allocated by an earlier call to calloc(), malloc(), or realloc(), and new_size contains the number of bytes you wish to allocate. RESULT If successful realloc() returns a generic pointer to an area of memory, otherwise it returns the macro NULL (a NULL pointer). NOTES If you wish to free the area of memory completely, the value passed to new_size must be ZERO. SEE ALSO calloc(), free(), malloc(). MENU LIBRARIES

remove
int remove (const char *file_name) HEADER stdio.h

PURPOSE To erase the file whose name is the string pointed to by file_name. RESULT If successful remove() returns ZERO, otherwise it returns NON ZERO. NOTES If the file is open when remove() is called, the actions carried out by this function are implementation defined. SEE ALSO rename(), tmpfile(). MENU LIBRARIES

rename
int rename(const char *old_name, const char *new_name)

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (55 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

HEADER

stdio.h

PURPOSE To change the name of a file, where old_name points to the files present name, and new_name to the one you wish to insert in its place. RESULT If successful, rename() returns ZERO, otherwise it returns a NON ZERO value. NOTES If the filename pointed to by new_name already exists, the actions of the function are implementation defined. Unless the length of *new_name is implementation defined, FILENAME_MAX will be the recommended size of the array. SEE ALSO remove(), tmpfile(). MENU LIBRARIES

rewind
void rewind (FILE *file_pointer) HEADER stdio.h

PURPOSE To move the file position indicator, to the beginning of the file pointed to by file_pointer. RESULT No value is returned by this function. NOTES rewind() also resets the EOF and ERROR flags, linked to *file_pointer, unlike fseek(), which only resets the EOF flag. If the file has been opened for read/write, a read may not be followed by a write. Or vice versa, without first calling either fflush(), fseek(), fsetpos(), or rewind. SEE ALSO fgetpos(), ftell(). MENU LIBRARIES

scanf
int scanf (const char *format [,argument] ...) HEADER stdio.h

PURPOSE To enable information to enter a program through stdin (the standard input device). Where argument contains the memory address used to store that information., format points to the type of alpha numeric or printable character contained in argument, and '...' indicates a flexible number of arguments.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (56 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

RESULT If successful, scanf() returns the number of variables correctly read, otherwise it returns ZERO if no characters were read, or EOF in the event of an error. To check whether the EOF character has been reached, call either feof() or ferror(). NOTES The following are some of the conversion specifications, that may be used in the string pointed to by format.

*c *d %c %d %e %E %f %g %G %hd %hi %ho %hu % hx

Ignore this character Ignore this integer A single character variable A signed decimal integer A floating point number (exponent) Treated by the system as %e A floating point number Allows the system to choose either %e or %f Treated by the system as %g A short integer A short integer constant An unsigned short integer (octal) An unsigned short integer

An unsigned short integer (hexadecimal)

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (57 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

%I %ld %le %lf %lg %li %lo %lu %lx %Le %Lf % Lg %n %o %p %s %u

A signed decimal integer in the form of a constant value A long integer A double precision number (exponent) A double precision number Allows the system to choose either %le or %lf A long integer constant An unsigned long integer (octal) An unsigned long integer An unsigned long integer (hexadecimal) A long double precision number (exponent) A long double precision number

Allows the system to choose either %Le or %Lf

The number of characters read so far An octal number A generic pointer produced using printf()

A pointer to a character string An unsigned integer

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (58 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

%x %X % []

A hexadecimal number (lowercase) Treated by the system as %x The square brackets contain a scanset of characters, which scanf() a string. looks for when reading

On finding one of these characters it finishes, returning a pointer to that part of the string. If ^ is the first character within the scanset, then scanf() will cease reading the string, when it finds a character not contained in the scanset. SEE ALSO fprintf(), fscanf(), printf(), sscanf(), vfprintf(), vprintf() vsprintf(), C99 . MENU LIBRARIES

setbuf
void setbuf (FILE *file_pointer, char *buffer) HEADER stdio.h

PURPOSE To link the character array pointed to by buffer, with the open file pointed to by file_pointer. RESULT No values are returned by this function. NOTES The character array must be BUFSIZ (at least 256) characters long. To unlink the file from the character array the value of *buffer must be the macro NULL (a NULL pointer). Modern programs use the function setvbuf() instead. SEE ALSO C99 . MENU LIBRARIES

setjmp
int setjmp (jmp_buf environ_buf) HEADER setjmp.h

PURPOSE To save the contents of the stack, into the buffer environ_buf, this information is then used by longjmp(), to jump back to setjump() 's position in the programs execution.
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (59 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

RESULT If successful, setjmp(), after saving the contents of the stack, will return ZERO. However, once longjmp() has been called and finished its execution, setjmp() then returns the value passed to it by longjmp(). If longjmp() passes ZERO, setjmp() will return a NON ZERO value. NOTES After longjmp() has finished, execution will move to the next statement after setjmp(). Both functions are used to call error handling or program recovery functions. MENU LIBRARIES

setlocale
char *setlocale (int category, const char *locale) HEADER locale.h

PURPOSE To change the dates, monetary values, and types of alpha numeric characters that a program will accept, for instance to enable a program to understand the Russian alphabet. Or to recognise decimal numbers, which use a comma instead of a decimal point. RESULT If successful, setlocale() returns a pointer to the string linked to category, otherwise setlocale() returns NULL. When the value of *locale is the macro NULL (a NULL pointer), setlocale() will return a pointer linked to the locale currently being used. NOTES One of the following values must be used by category:

LC_ALL

Modifies all location categories

LC_COLLATE

Modifies strcoll() ()

strfxfrm

LC_CTYPE

Modifies character functions in ctype.h , and the C99 wide character classification functions iswctype() , towctrans() , wctrans() , wctype()

LC_MONETARY

Modifies currency

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (60 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

LC_NUMERIC

Changes the character used to represent the decimal point

LC_TIME

Modifies

strftime()

*locale can use one of the following: 'C' Select the 'C' environment " " Select the native environment

SEE ALSO localeconv(), time(). MENU LIBRARIES

setvbuf
int setvbuf (FILE *file_pointer, char *buffer,int access_mode, size_t width) HEADER stdio.h

PURPOSE To link the character array pointed to by buffer, with the file pointed to by file pointer. Where width is the length of the array in bytes, and access_mode contains that files particular mode of access. RESULT If successful, setvbuf() returns ZERO. Otherwise it will return a NON ZERO value. NOTES If the value contained within *buffer is the macro NULL (a NULL pointer), setvbuf() will choose its own buffer. Any buffer created by YOU the programmer does not need to be BUFSIZ (at least 256) characters long. access_mode may contain one of the following: _IOFBF _IOLBF Full input/output buffering. Buffer is flushed each time a new line is entered, when it is full, or when it is read. No buffering takes place, (information is read or written directly to and from the file).

_IONBF

SEE ALSO setbuf(), C99 MENU LIBRARIES

signal
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (61 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

void (*signal (int signal_num,void (*sig_handler)(int signal_num))) (int ret_value) HEADER signal.h

PURPOSE To record the function pointed to by sig_handler(), as a signal handler. If this function receives the value contained in signal_num, from outside the program. Or is called by raise(), it will be activated. RESULT If successful, *sig_handler() returns the previous value of sig_handler, otherwise it returns SIG_ERR and a positive value is stored in errno. If *sig_handler() itself returns a value, the program will continue execution at the point where it was interrupted, unless the value of signal_num was SIGFPE or an implementation defined value. Otherwise, it may call abort(), exit(), or longjmp(). NOTES Under MSDOS, signal() is used to test interrupt handler functions. The value contained in signal_num must be one of the following:

SIGABRT SIGFPE SIGINT SIGSEGV SIGTERM SIGILL

Abnormal exit produced by calling abort().

Floating point error caused by dividing a number by ZERO, a data overflow, or underflow. Interupt signal received, possibly from the keyboard. Segment error caused by faulty memory allocation. Terminate this program. An illegal instruction.

The value passed to *sig_handler(), must be either the address of the signal handler function, or one of the following: SIG_DFL SIG_IGN Use the default signal handler, this usually terminates the program. Ignore this signal.

Lastly this function is not clearly defined within the ANSI Standard, its actions will vary from one piece of hardware to another. SEE ALSO assert(), raise().
file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (62 of 63) [21-06-2008 18:24:36]

A Dictionary of ANSI Standard C Function Definitions

MENU

LIBRARIES

sin
double sin (double angle) HEADER math.h

PURPOSE To calculate the sine of the double precision value passed to angle.

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2...ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (63 of 63) [21-06-2008 18:24:36]

Anda mungkin juga menyukai