You are on page 1of 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]

23) (1.60) (0. RESULT If successful.59) (0.99) (0. either localtime() gmtime() must be called. hour.365) int tm_isdst If the value of tm_isdst time indicator is switched on. or ctime() stored within the string may be overwritten. asctime() returns a pointer to the buffer where the character string has been stored. information . is negative the indicator is not being used. minutes. year.11) the number of years since 1900 the number of days since Sunday the number of days since January 1st (0.htm (4 of 63) [21-06-2008 18:24:36] . file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. This is then placed into a string 26 characters long. in the form of weekday. NOTES Each time either asctime() . The tm structure is called. day of the month.A Dictionary of ANSI Standard C Function Definitions PURPOSE To obtain the current date. seconds. the daylight savings is ZERO then the indicator is switched off. pointed to by To initialise the tm structure currtime .31) the number of months since January (0.6) int tm_yday (0. otherwise the value it returns is implementation defined. 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. 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. month.

htm (5 of 63) [21-06-2008 18:24:36] . C99. and an implementation defined value returned. MENU LIBRARIES asin double asin (double angle) HEADER math. RESULT If successful. in either case errno is set to ERANGE. but whether errno is set to ERANGE is implementation defined.HUGE_VAL. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.h PURPOSE To convert the double precision value passed to angle into its arc sine. NOTES assert() is implemented as a macro not a function. time(). assert() generates an implementation defined error message. tanh(). Following this it calls abort(). asin() returns + or . NOTES If the value contained within angle is neither a double number. and _LINE_ (the line where the error occurred). sin(). cos(). in radians. tan(). SEE ALSO acos(). nor between -1 and 1. If the result of the comparison is ZERO. atan2(). MENU LIBRARIES assert void assert (int comparison) HEADER assert. sinh(). Showing the predefined macros _FILE_ (the name of the file). a range error (an illegal return value) will occur. together with the values contained within comparison.h PURPOSE To help track down errors of logic within a program.0. otherwise if the value returned by asin() is not a double. asin() returns the arc sine of angle. difftime(). the behavior of that function is undefined. If the assert() macro is replaced by a function. Or if the value is too large to fit inside a double. RESULT No values are returned by this function. A domain error (a illegal argument) will occur.A Dictionary of ANSI Standard C Function Definitions SEE ALSO clock(). atan(). the global integer errno set to EDOM. If the value is too small asin() returns 0. cosh().

Or if the value is too large to fit inside a double. If you wish to switch assert() off. A domain error (an illegal argument) will occur. atan2() returns the value of the arc tangent in radians. a range error (an illegal return value) will occur. a range error (an illegal return value) will occur.A Dictionary of ANSI Standard C Function Definitions Otherwise assert() will allow the program to continue. RESULT atan() returns the arc tangent of angle. tan(). and an implementation defined file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.h PURPOSE To convert the double precision value passed to angle into its arc tangent. SEE ALSO acos(). sinh(). atan() returns + or . atan2() returns + or . asin(). the global integer errno set to EDOM. otherwise if the value returned by atan2() is not a double. MENU LIBRARIES atan double atan (double angle) HEADER math.HUGE_VAL. after the program has been tested for bugs. the global integer errno set to EDOM. If the value is too small atan() returns 0. sin().htm (6 of 63) [21-06-2008 18:24:36] . NOTES If the values of both first and second do not contain double precision numbers. otherwise if the value returned by atan() is not a double. #define the macro NDEBUG. or contain ZERO.0. and an implementation defined value returned. MENU LIBRARIES atan2 double atan2 (double first. but whether errno is set to ERANGE is implementation defined. atan2(). SEE ALSO raise(). signal(). C99. in radians. NOTES If the value contained within angle is not a double value. double second) HEADER math. a domain error (an illegal argument) will occur. but whether errno is set to ERANGE is implementation defined. Or if the value is too large to fit inside a double.0.h PURPOSE To calculate the value of the arc tangent of first divided by second. in either case errno is set to ERANGE. in either case errno is set to ERANGE. cos(). cosh(). tanh(). RESULT If successful.HUGE_VAL. If the value is too small atan2() returns 0. using the signs of both arguments to calculate its quadrant.

cosh(). SEE ALSO abort(). it does not have to change the value of the global integer errno. Otherwise a NON ZERO value is returned. will be called when the program terminates normally. getenv(). Otherwise its behavior is implementation defined. system().htm (7 of 63) [21-06-2008 18:24:36] . atof() returns a double value. MENU LIBRARIES atexit int atexit (void(*func)(void)) HEADER stdlib. these functions cannot have parameters. The character array must contain the following in this order:[WHITE SPACE SIGN] INTEGER DECIMAL POINT INTEGER [d. the value returned cannot be used. cos().D.h PURPOSE The function pointed to by func(). sin(). They are called in reverse order by exit(). MENU LIBRARIES atof double atof (const char *string) HEADER PURPOSE To convert the character array pointed to by string into a double precision value.E SIGN INTEGER] stdlib. tan(). NOTES ANSI allows a minimum of 32 termination functions to be nominated. atan(). SEE ALSO acos(). sinh(). C99. tanh(). NOTES If *string does not contain a floating point number.h file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.A Dictionary of ANSI Standard C Function Definitions value returned. asin().e. RESULT atexit() returns ZERO if the function exists and can be nominated. RESULT If successful.

SEE ALSO atof().htm (8 of 63) [21-06-2008 18:24:36] . atol(). strtol(). which consists of an introductory letter. which are both ignored. 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. If no numbers appear before the DECIMAL POINT then at least one must appear after it. SIGN is either + or -. pointed to by string into an integer value. Otherwise its behavior is implementation defined. either d. The character array will be processed by atof(). atoi() returns an integer value.h PURPOSE To convert the contents of the character array. The numbers may be followed by an exponent. and is also optional. and is also optional. strtoul(). it does not have to change the value of the global integer errno. strtod(). atol(). atoi() does not recognise decimal points or exponents. which are both ignored. INTEGER may contain one or more decimal numbers. D.A Dictionary of ANSI Standard C Function Definitions A WHITE SPACE consists of an optional space and or a tab character. or E and an optional signed integer. strtod(). MENU LIBRARIES file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%20Dictionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. e. strtol(). INTEGER may contain one or more decimal numbers. strtoul(). this includes `\0`. RESULT If successful. MENU LIBRARIES atoi int atoi (const char *string) HEADER stdlib. The character array is processed by atoi() until the function reaches a character which it does not recognise . SEE ALSO atoi(). this includes `\0`. until the function reaches a character which it doesn't recognize. SIGN is either + or -.

NOTES The character array pointed to by string must contain a long integer value. atol() does not recognise decimal points or exponents. key2 points to the same character pointed to by key1 within bsearch().A Dictionary of ANSI Standard C Function Definitions atol long int atol (const char *string) HEADER stdlib. atoi(). compare points to a user defined function. INTEGER may contain one or more decimal numbers. 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] . and width the size in bytes of each element. const void *elem)) HEADER stdlib. this includes `\0`. int (*compare) (const void *key2. strtod(). bsearch() itself returns a generic pointer. strtol(). while elem points to an individual element within the sorted array. strtoul().h PURPOSE To convert the character array pointed to by string into a long integer. RESULT If successful. SIGN is either + or -. and is also optional. const void *buffer. size_t length. which are both ignored. Otherwise its behavior is implementation defined. MENU LIBRARIES bsearch void *bsearch (const void *key1. and take the form:[WHITE SPACE SIGN] LONG INTEGER A WHITE SPACE consists of an optional space and or a tab character. The character array will then be processed by atol() until the function reaches a character which it doesn't recognise. Where length is the number of array elements. it does not have to change the value of the global integer errno. until a match is found with the character pointed to by key1.h PURPOSE To perform a binary search on the sorted array pointed to by buffer. SEE ALSO atof(). RESULT If atol() returns a long integer. size_t width. which carries out the actual comparison.

. MENU LIBRARIES file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. 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. with the lowest array element containing the lowest value.h PURPOSE To allocate an area of memory for an array of elements.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.. RESULT If successful. size_t length) HEADER stdlib. Otherwise it returns the macro NULL (a NULL pointer). 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. calloc()initialises all the bits within the array to ZERO. SEE ALSO qsort(). The user defined function pointed to by compare is called at least once by bsearch().A Dictionary of ANSI Standard C Function Definitions returns the macro NULL (a NULL pointer). realloc(). calloc() returns a generic pointer to the beginning of the area of memory allocated. MENU LIBRARIES calloc void *calloc (size_t num. NOTES Unlike malloc().htm (10 of 63) [21-06-2008 18:24:36] . SEE ALSO free(). Where num is the number of individual elements and length their size in bytes. It must not contain duplicate records with identical keys.

floor().h . MENU LIBRARIES clearerr void clearerr (FILE *file_pointer) HEADER stdio. otherwise if the value returned by ceil() is not a double. NOTES If the value contained within upwards is not a double. and to reset the End Of File indicator associated with the file pointed to by file_pointer. perror(). an implementation defined value is returned. rounded up to its next whole number.HUGE_VAL. and the global integer errno set to EDOM.. ferror().0.htm (11 of 63) [21-06-2008 18:24:36] time. SEE ALSO fabs(). rewind().h PURPOSE To calculate the double precision value passed to upwards. a range error (an illegal return value) will occur. A domain error (an illegal argument) will occur.h PURPOSE To switch the file error flag off. RESULT If successful ceil() returns a double value. SEE ALSO feof(). MENU LIBRARIES clock clock_t clock (void) HEADER PURPOSE file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. ftell(). fseek().A Dictionary of ANSI Standard C Function Definitions ceil double ceil (double upwards) HEADER math. Or if the value is too large to fit inside a double.. fmod(). in either case errno is set to ERANGE. If the value is too small ceil() returns 0. fsetpos(). RESULT No values are returned by this function. rounded up to the next whole number. fgetpos(). When a domain error occurs.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. ceil() returns + or .

C99. a domain error (an illegal argument) will occur.h PURPOSE To convert the double precision value passed to angle into its hyperbolic cosine. time(). in radians.HUGE_VAL.h PURPOSE To convert the double precision value passed to angle into its cosine. otherwise if the value returned by cosh() is not a double. atan(). sinh(). file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. strftime(). and an implementation defined value returned. otherwise it returns (clock_t)-1. tan(). cos() returns the cosine of angle. otherwise if the value returned by cos() is not a double. MENU LIBRARIES cosh double cosh (double angle) HEADER math. tanh(). SEE ALSO asctime().htm (12 of 63) [21-06-2008 18:24:36] . the global integer errno set to EDOM.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. a range error (an illegal return value) will occur. gmtime(). MENU LIBRARIES cos double cos (double angle) HEADER math.atan2(). RESULT If successful. asin().0. ctime().A Dictionary of ANSI Standard C Function Definitions To find out how long a distinct process within a program has been running. in radians. but whether errno is set to ERANGE is implementation defined. sin(). RESULT If successful.. a range error (an illegal return value) will occur. difftime(). cosh(). cos() returns + or . mktime().. in either case errno is set to ERANGE. as an variable of type clock_t. localtime(). NOTES To convert the value returned by clock() into seconds divide it by the macro CLOCKS_PER_SEC. NOTES If the value contained within angle is not a double number. Or if the value is too large to fit inside a double. cosh() returns the hyperbolic cosine of angle. If the value is too small cos() returns 0. RESULT If successful. SEE ALSO acos(). clock() returns the amount of time the entire program has been running.

is called. NOTES If the value contained within angle is not a double number.A Dictionary of ANSI Standard C Function Definitions Or if the value is too large to fit inside a double. Which is placed in a string 26 characters long. hours. otherwise it returns an implementation defined value. atan(). cosh() returns + or . cos(). Each time either asctime(). RESULT If successful. in either case errno is set to ERANGE. but whether errno is set to ERANGE is implementation defined. and an implementation defined value returned. SEE ALSO acos(). difftime() returns a double precision value.. NOTES file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. a domain error (an illegal argument) will occur. must be obtained by calling time(). SEE ALSO clock(). information stored within the string may be overwritten.. tan(). MENU LIBRARIES ctime char *ctime (const time_t *num_seconds) HEADER time. C99. the global integer errno set to EDOM. a pointer to the calendar time. .ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. containing an implementation defined variable. year. The calendar time is stored as a object of type time_t. difftime(). sinh(). If the value is too small cosh() returns 0. MENU LIBRARIES difftime double difftime (time_t end. NOTES Before calling ctime() num_seconds. sin(). where the character string has been stored. ctime() returns a pointer to the buffer. tanh().HUGE_VAL.htm (13 of 63) [21-06-2008 18:24:36] . month. atan2(). containing the time difference in seconds. RESULT If successful. day of month. minutes.h PURPOSE To obtain the local time in the form of weekday. asin().h PURPOSE To calculate the difference in seconds between the value passed to end (the end of a period of time).0. or ctime() . and that passed to begin (the beginning). time_t begin) HEADER time. seconds.

although they do not have to appear in that order: typedef struct { int quot. The values contained within begin and end can be obtained by calling clock() on two separate occasions. ctime(). file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. otherwise the value returned is implementation defined. int divider) HEADER stdlib. SEE ALSO asctime().htm (14 of 63) [21-06-2008 18:24:36] . int rem. strftime(). time(). RESULT If successful. clock().h PURPOSE To divide the value passed to number. and the remainder of the division as two separate values.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. NOTES exit() can be executed only once within a program. localtime(). mktime()..A Dictionary of ANSI Standard C Function Definitions time_t is an object which stores time as an implementation defined variable. However. labs().. div() returns a div_t structure containing both the quotient. by the value contained in divider. RESULT No values are returned by this function.. many implementations terminate with an error message. NOTES If the value contained in divider is ZERO. ldiv() MENU LIBRARIES exit void exit (int exit_code) HEADER stdlib. gmtime(). The div_t structure contains the following members. MENU LIBRARIES div div_t div (int number.h PURPOSE To terminate the program which calls it. } div_t div SEE ALSO abs(). the behavior is implementation defined.

Or if the value is too large to fit inside a double.g positive) value of num. C99 . MENU LIBRARIES exp double exp (double num) HEADER math. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. and the global integer errno set to EDOM. otherwise if the value returned by exp () is not a double. RESULT If successful fabs() returns the absolute value of num as a double precision number.h PURPOSE To calculate the absolute (e. NOTES If the value contained within num is not a double. an implementation defined value is returned.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. When exit() is called any functions nominated by atexit() will be called in their reverse order. SEE ALSO abort()..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. MENU LIBRARIES fabs double fabs (double num) HEADER math. after the buffers linked to them have been emptied. a range error (an illegal return value) will occur. Or if the value is too large to fit inside a double. All temporary files created by tmpfile() are deleted. RESULT If successful. a range error (an illegal return value) will occur. exp() returns a double precision value containing e to the power of num. otherwise if the value returned by fabs() is not a double. fabs() returns + or . in either case errno is set to ERANGE.htm (15 of 63) [21-06-2008 18:24:36] . The other macro used by exit_code is EXIT_FALSE . a domain error (an illegal argument) will occur.. Any files which are still open will be closed.HUGE_VAL.HUGE_VAL. SEE ALSO log. If the value is too small exp() returns 0. in either case errno is set to ERANGE. exp() returns + or . any other implementation defined value indicates an error of some kind.0.h PURPOSE To calculate the natural logarithm e. raised to the power of num. When a domain error occurs.

However.. a domain error (an illegal argument) will occur. and its contents flushed to that particular file. Otherwise it returns EOF. MENU LIBRARIES fclose int fclose (FILE *file_pointer) HEADER stdio. fseek(). RESULT If successful. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. NOTES The absolute value of a number can only be positive. fmod().0.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (16 of 63) [21-06-2008 18:24:36] . fclose() will return ZERO. MENU LIBRARIES feof int feof (FILE *file_pointer) HEADER stdio. If the value contained within num is not a double. RESULT If the The End Of File indicator has been set. ceil(). NOTES Information in the buffer pointed to by file_pointer will be emptied.h PURPOSE To close the file pointed to by file_pointer. or rewind() will clear the EOF indicator. SEE ALSO abs(). feof() will return NON ZERO . fsetpos(). and the global integer errno set to EDOM.h PURPOSE To check whether the end of the file pointed to by file_pointer has been reached. floor(). SEE ALSO fflush(). an implementation defined value is returned.. fopen(). NOTES feof() is often used when working with binary files.A Dictionary of ANSI Standard C Function Definitions If the value is too small fabs() returns 0. labs(). Calling clearerr(). Otherwise it returns ZERO. data which is waiting to be read will be discarded. When a domain error occurs. freopen().

otherwise it returns EOF.. fsetpos().htm (17 of 63) [21-06-2008 18:24:36] .ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. fseek(). MENU LIBRARIES fflush int fflush (FILE *file_pointer) HEADER stdio. MENU LIBRARIES ferror int ferror (FILE *file_pointer) HEADER stdio. MENU LIBRARIES fgetc file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. or clearerr() are called. RESULT If successful. fopen().h PURPOSE To check for read/write errors in the file pointed to by file_pointer. into the file pointed to by file_pointer. SEE ALSO fclose(). setvbuf(). If the file has been opened for read/write. NOTES Those error flags linked to file_pointer will remain set until either fclose(). freopen(). without first calling either fflush(). SEE ALSO feof(). RESULT If an error has been detected ferror() will return NON ZERO. perror()..h PURPOSE To empty the contents of the output buffer. perror(). ferror() is often used when checking for errors in binary files.A Dictionary of ANSI Standard C Function Definitions SEE ALSO ferror(). or rewind(). Or vice versa. NOTES To flush ALL output buffers call fflush(NULL). setbuf(). fflush() returns ZERO. rewind(). a read may not be followed by a write.

fwrite(). fgetc() will return the numerical value of the character read.h PURPOSE To obtain the next character from the file pointed to by file_pointer. and ferror() to check for errors.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. a read may not be followed by a write. without first calling either fflush().. ftell(). RESULT If successful. C99 . fputc(). fseek(). or rewind(). puts(). putc(). putchar(). otherwise it returns NON ZERO storing an implementation defined positive value in the global integer errno. int width. When working with binary files. MENU LIBRARIES fgetpos int fgetpos (FILE *file_pointer. NOTES fgetc() will also return EOF in the event of a read error. feof() must be called.htm (18 of 63) [21-06-2008 18:24:36] . If the file has been opened for read/write. getc(). rewind(). NOTES The information stored in position can be used later by fsetpos() to return the file position indicator to its former location. MENU LIBRARIES fgets char *fgets (char *string. this value will then be stored in the area of memory pointed to by position.h PURPOSE To obtain the location of the file position indicator linked to *file_pointer. fsetpos(). SEE ALSO fflush(). unless EOF was the last character read by fread() SEE ALSO fgets().. and increment the file position indicator. fputs(). FILE *file_pointer) file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. fseek(). RESULT If successful.A Dictionary of ANSI Standard C Function Definitions int fgetc (FILE *file_pointer) HEADER stdio. gets(). Otherwise it will return EOF. Or vice versa. fpos_t *position) HEADER stdio. to check that the End Of File position has been reached. getchar(). fgetpos() will return ZERO.

MENU LIBRARIES floor double floor (double lower) HEADER math. putc(). fread().htm (19 of 63) [21-06-2008 18:24:36] .. fabs(). C99 . RESULT If successful. putchar(). getc(). fputc(). either feof() or ferror() needs to be called. otherwise it returns the macro NULL (a NULL pointer). fwrite(). If the value is too small floor() returns 0. RESULT If successful floor() returns a double value rounded down to its nearest whole number.h PURPOSE To read a line of width . floor() returns + or . MENU LIBRARIES fmod double fmod (double first.h PURPOSE To round the double precision value passed to lower.A Dictionary of ANSI Standard C Function Definitions HEADER stdio. NOTES fgets() will continue to read characters until either the '\n' or EOF character is received.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. To check whether an error has occurred or the EOF character has been reached.1 number of characters long into the buffer pointed to by string. fmod(). puts(). At the end of the string an '\0' character is added.. SEE ALSO fgetc(). double second) HEADER math. down to its next whole number. the '\n' character will be copied into *string.0. an implementation defined value is returned. If the length of the line of characters is less than width. SEE ALSO ceil(). from the file pointed to by file_pointer. gets(). When a domain error occurs. getchar(). Or if the value is too large to fit inside a double.HUGE_VAL. and the global integer errno set to EDOM. fgets() will return the address of the input buffer. in either case errno is set to ERANGE. otherwise if the value returned by floor () is not a double. NOTES If the value contained within lower is not a double a domain error (an illegal argument) will occur.h file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. a range error (an illegal return value) will occur.

create one if it does not already exist.HUGE_VAL. whether a domain error occurs or fmod() returns 0. a read may not be followed by a write. an implementation defined value is returned. in either case errno is set to ERANGE. Since three are always assigned to stdin (standard input). fabs().htm (20 of 63) [21-06-2008 18:24:36] . file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. MENU LIBRARIES fopen FILE *fopen (const char *file_name. without first calling either fflush(). Or if the value is too large to fit inside a double. Unless EOF was the last character read by fread(). stdout (standard output). floor(). otherwise if the value returned by fmod() is not a double.. and stderr (standard error). RESULT If successful fmod() returns a positive double precision value that is less than the value of second. a domain error (an illegal argument) will occur. FILENAME_MAX will be the recommended size of the array. If the file has been opened for read/write. SEE ALSO ceil(). However. and the global integer errno set to EDOM.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.0. fseek(). NOTES If the values of both first and second do not contain double precision numbers. fsetpos(). The macro FOPEN_MAX determines the number of files that a program may have open at the same time. const char *mode) HEADER stdio. append to the bottom of the file. where mode points to the type of access allowed. When a domain error occurs. If the value is too small fmod() returns 0. If the value of second is ZERO. or rewind(). whose name is pointed to by file_name. fmod() returns + or .A Dictionary of ANSI Standard C Function Definitions PURPOSE To calculate the remainder of first divided by second.0 is implementation defined. The parameter pointed to by mode must contain one of the following values: "a" Open a text file for writing. these three can if necessary be reassigned using freopen(). that leaves five.h PURPOSE To open the file.. a range error (an illegal return value) will occur. Or vice versa. RESULT If successful. NOTES Unless the length of *file_name is implementation defined. fopen() returns a pointer to the opened file. Otherwise it returns the macro NULL (a NULL pointer). under MSDOS this will be at least eight.

"ab+" Open a binary file for reading and writing. C99 . "wb" Open a binary file for writing. if it already exists erase the contents.. if it already exists erase the contents. fgetpos().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. append to the bottom of a file.htm (21 of 63) [21-06-2008 18:24:36] . "wb+" Open a binary file for reading and writing. if it already exists erase the contents. "rb+" Open a binary file. "r" Open a text file. for reading and writing. . create one if it does not already exist.h PURPOSE To write a series of alphanumeric or printable characters to the file pointed to by file_pointer. if it already exists erase the contents. otherwise create one.. "rb" Open a binary file. if it already exists erase the contents. for reading and writing. if it already exists for reading. if it already exists for reading "r+" Open a text file. Where format points to the type of alphanumeric or printable character or characters. "ab" Open a binary file for writing. [argument]. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. SEE ALSO fclose().A Dictionary of ANSI Standard C Function Definitions "a+" Open a text file for reading and writing. "w+" Open a text file for reading and writing. which will be contained in argument.. const char *format. append to the bottom of the file. create one if it does not already exist.) HEADER stdio.. if it already exists erase the contents. MENU LIBRARIES fprintf int fprintf (FILE *file_pointer. "w" Open a text file for writing. append to the bottom of the file. create one if it does not already exist. ftell().

RESULT If successful. puts().h PURPOSE To write a character to the file pointed to by file_pointer. into the file pointed to by file_pointer. fputs() returns a positive value. and increment its file position indicator. FILE *file_pointer) HEADER stdio.. putchar().A Dictionary of ANSI Standard C Function Definitions and '. RESULT If successful. scanf(). SEE ALSO fgetc(). Use ferror() to check whether an error has occurred. not a macro. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.. fputc() is more likely to be a function. the character is appended to the end of the file. getchar().. gets().. A minimum of 509 characters can be written at any one time. vsprintf() C99 MENU LIBRARIES fputc int fputc (int ch. fputc() returns a positive value corresponding to the character written. FILE *file_pointer) HEADER stdio. otherwise a negative value is returned. vprintf(). RESULT If successful. If no file position indicator exists. fgets(). MENU LIBRARIES fputs int fputs (const char *string. getc(). However.h PURPOSE To write the character array pointed to by string. vfprintf().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. Otherwise it returns EOF. sprintf(). The value passed to ch is converted by fputc() into an unsigned char. sscanf(). otherwise it returns EOF. ungetc(). NOTES The rules that apply to *format are the same as for printf(). NOTES This function performs the same action as putc(). fprintf returns the number of characters that have been written to the file. SEE ALSO fscanf().' indicates a variable number of arguments. fputs().htm (22 of 63) [21-06-2008 18:24:36] .

puts(). file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. FILE *file_pointer) HEADER stdio.. fputc(). getc(). gets(). fsetpos().h PURPOSE To read a group or groups of variables from a file pointed to by file_pointer. fgets(). RESULT If successful. ftell(). size_t count. putchar(). malloc(). or realloc().or rewind(). putc(). Where count is the number of groups is to be read. or vice versa. Unless EOF was the last character read by fread(). fread() returns the number of groups read. and increments the file position indicator.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. MENU LIBRARIES fread size_t fread (void *buffer. C99 . a read may not be followed by a write. ungetc().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. NOTES If the file pointed to by file_pointer is in text mode. SEE ALSO fwrite(). and width their length in bytes. MENU LIBRARIES free void free (void *memory_ptr) HEADER stdlib. RESULT No values are returned by this function. If the value contained in memory_ptr is the value NULL (a NULL pointer) no action occurs. If the file has been opened for read/write. fseek().. fgetpos().htm (23 of 63) [21-06-2008 18:24:36] . NOTES Before calling free() the area of memory pointed to by memory_ptr. all carriage return line feed characters will be replaced by single line feed characters. size_t width. must have been assigned by calling either calloc(). into the array pointed to by buffer. getchar(). C99 . without first calling either fflush().h PURPOSE To free an area of memory. SEE ALSO fgetc(). otherwise it returns ZERO.

to files on disk or to other devices. freopen() clears the error and end of file indicators. and store ZERO in *exp..ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. NOTES If the values passed to frexp are not.h PURPOSE To close the file. in either case errno is set to ERANGE. FILENAME_MAX will be the recommended size of the array. fflush(). frexp() will return ZERO. in that order. setvbuf(). const char *mode.5 to 0.HUGE_VAL. an implementation defined value is returned.0. freopen() returns the address of the new file. NOTES Unless the length of *new_file is implementation defined. setbuf(). RESULT If successful. linked to file_pointer.. and the global integer errno set to EDOM. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. and stdout (standard output device). frexp() returns 0. See fopen() for a complete description of *mode. A domain error (an illegal argument) will result. freopen() can be used to redirect stderr (standard error device). or num equals ZERO.h PURPOSE To convert the value passed to num into its mantissa.999. MENU LIBRARIES frexp double frexp (double num. SEE ALSO fclose(). If num contains ZERO. a double precision number and an integer. Or if the value is too large to fit inside a double.within the range of 0.frexp() returns + or . C99 . int *exp) HEADER math. If the value is too small.htm (24 of 63) [21-06-2008 18:24:36] . a range error (an illegal return value) will occur. otherwise if the value returned by frexp() is not a double. whose name is pointed to by file_pointer. FILE *file_pointer) HEADER stdio. Where new_file points to the name of the new file. and stores the exponent in the integer pointed to by exp. and mode the file access mode. which is then reassigned to another file. otherwise it returns the macro NULL (a NULL pointer). stdin (standard input device). RESULT If successful frexp() returns the mantissa of num.A Dictionary of ANSI Standard C Function Definitions MENU LIBRARIES freopen FILE *freopen (const char *new_file. When a domain error occurs.

const char *format... log(). int start_point) HEADER stdio. printf(). ldexp(). within the file pointed to by file_pointer. call either feof() or ferror(). RESULT If is successful. SEE ALSO fprintf(). 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.. long int offset... To check whether the EOF character has been reached.h PURPOSE To reset the file position indicator. *format describes the type of alphanumeric or printable characters contained in argument. MENU LIBRARIES fscanf int fscanf (FILE *file_pointer. or ZERO if none were read.htm (25 of 63) [21-06-2008 18:24:36] . vfprintf().) HEADER stdio. fseek() returns ZERO. fscanf() returns the number of groups of variables that have been read. modf(). C99 . 'indicates a variable number of arguments. the current position of that indicator. vprintf().. MENU LIBRARIES fseek int fseek (FILE *file_pointer. and '. into the areas of memory specified by argument.. sscanf(). Otherwise it returns a NON ZERO value.vsprintf().h PURPOSE To read information from the file pointed to by file_pointer. sprintf(). [argument].A Dictionary of ANSI Standard C Function Definitions SEE ALSO exp(). Where offset is the number of bytes that need to be added to start_point. and will reset the End Of File indicator. Otherwise it returns EOF in the case of an error. Where argument contains the addresses of those memory areas.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. log10(). RESULT If successful. NOTES fseek() supports random input/output operations. NOTES See scanf() for a complete description of *format.

SEE ALSO fgetpos(). NOTES The value pointed to by position must be obtained by calling fgetpos(). Or vice versa. If ungetc() has been called immediately before fseek() any action it has caused will be ignored. fwrite().. or rewind(). fsetpos(). without first calling either fflush(). If the file has been opened for read/write. Otherwise it returns a NON ZERO value. fread().htm (26 of 63) [21-06-2008 18:24:36] . When using text files the value contained within offset. without first calling either fflush().h PURPOSE To move the file position indicator pointed to by file_pointer. . and stores an implementation defined positive number in the global integer errno. fseek(). If the file has been opened for read/write. to the location pointed to by position. RESULT If successful. ftell(). fsetpos() undoes the work of ungetc(). in bytes from the beginning of the file.. MENU LIBRARIES fsetpos int fsetpos (FILE *file_pointer. Or vice versa. and resets the End Of File indicator.A Dictionary of ANSI Standard C Function Definitions SEEK_SET - seek from the beginning of the file may not always work with binary files. SEE ALSO fread(). should be either 0L or returned by ftell(). const fpos_t *position) HEADER stdio. MENU LIBRARIES ftell long int ftell (FILE *file_pointer) HEADER stdlib.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. or rewind(). a read may not be followed by a write. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. fseek(). a read may not be followed by a write. fwrite().h PURPOSE To obtain the location of the file position indicator pointed to by file_pointer. fsetpos() returns ZERO. fsetpos(). SEEK_END - The carriage return line feed characters contained within text files will cause results to be unpredictable.

Unless EOF was the last character read by fread(). FILE *file_pointer) HEADER stdio. a read may not be followed by a write. and stores an implementation defined positive value in the global integer errno.. RESULT If successful fwrite() returns the number of groups written to the file. NOTES If the file has been opened for read/write. MENU LIBRARIES fwrite size_t fwrite (const void *buffer. fsetpos(). as an offset in relation to the beginning of the file. size_t count. ftell() returns the location of the file position indicator. SEE ALSO fread(). or rewind().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. fsetpos(). rewind().A Dictionary of ANSI Standard C Function Definitions RESULT If successful. C99 . getc() returns the numerical value of the character read. size_t width. RESULT If successful.should be used with fseek().htm (27 of 63) [21-06-2008 18:24:36] . fseek(). Where count is the number of groups being written. Or vice versa. otherwise it returns EOF. NOTES When using text files the long value returned by ftell(). fgetpos(). without first calling either fflush(). SEE ALSO fgetpos(). from the character array pointed to by buffer. MENU LIBRARIES getc int getc (FILE *file_pointer) HEADER stdio. and width is the length of an individual group in bytes. Otherwise it returns the -1L. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. fwrite(). In the event of an error this value will be less than count..h PURPOSE To increment the file position indicator and write groups of variables to the file pointed to by file_pointer.h PURPOSE To read a character from the file pointed to by file_pointer.

without first calling either fflush(). putchar(). NOTES getchar() does not display the character it has received on the screen. putc(). or rewind(). Use feof() or ferror() to check whether the End Of the File has been reached or an error has occurred. ungetc(). puts(). fputs(). fputc(). Or vice versa.h PURPOSE To obtain specific information relating to file directories. NOTES The string pointed to by env_name may be overwritten the next time getenv() is called.h PURPOSE To read a character from stdin (the standard input device).. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. RESULT If successful. If the file has been opened for read/write. Unless EOF was the last character read by fread() SEE ALSO fgets(). ungetc(). getchar(). fputc(). puts(). gets().. Use ferror() or feof() to check whether an error has occurred. contained in the environment list provided by the host environment. fseek(). usually after the enter key has been pressed. otherwise it returns EOF. gets(). MENU LIBRARIES getenv char *getenv (const char *env_name) HEADER stdlib. or the End Of File has been reached. putc(). fputs(). otherwise it returns the macro NULL (a NULL pointer). getc().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. fsetpos(). putchar(). SEE ALSO fgetc().A Dictionary of ANSI Standard C Function Definitions NOTES getc() may be implemented by a macro using fgetc().htm (28 of 63) [21-06-2008 18:24:36] . whose entry title matches the string pointed to by env_name. MENU LIBRARIES getchar int getchar (void) HEADER stdio. getchar() returns the numerical value of the character read. a read may not be followed by a write. fgets(). RESULT If successful getenv() returns a pointer to the environment list entry. and may be implemented by a macro using getc().

When using either MSDOS or OS/2. fputs(). Use feof() or ferror() to check whether the EOF character has been received.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. system(). This information is then stored within a tm structure.. putc(). The object time_t stores time as an implementation defined variable. use fgets() instead. fputc(). putchar(). exit(). gets() returns a pointer to the character array. when an error has occurred or the EOF character has been received. NOTES To initialise num_seconds. Otherwise it will return the macro NULL (a NULL pointer). getc().htm (29 of 63) [21-06-2008 18:24:36] . SEE ALSO clock().A Dictionary of ANSI Standard C Function Definitions SEE ALSO atexit(). RESULT If successful gmtime() returns a pointer to a tm structure. information contained within the tm structure may be overwritten. into Coordinated Universal Time (UTC). MENU LIBRARIES gmtime struct tm *gmtime (const time_t *num_seconds) HEADER time. the function time() must be called. ungetc(). ctime(). gmtime(). For that reason it is not recommended that you use this function with INTERNET programs. time() file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. into the character array pointed to by string. otherwise it returns the macro NULL (a NULL pointer). dates before 1980 may cause gmtime() to return NULL. getchar(). NOTES gets() will read the string until it receives either an '\n'. when that happens the array is terminated by an '\0'. Each time asctime(). difftime().h PURPOSE To read a string from stdin (the standard input device). SEE ALSO fgetc(). or localtime() is called.. RESULT If successful. MENU LIBRARIES gets char *gets (char *string) HEADER stdio. puts().h PURPOSE To convert the calendar time pointed to by num_seconds. or EOF character.

SEE ALSO isalpha().h PURPOSE To check whether the value passed to letter_number is alphanumeric. iscntrl(). e. isalnum() returns a NON ZERO value. isprint(). islower().h . isgraph(). isprint(). isupper(). isgraph(). C99. isdigit(). isspace(). isupper(). otherwise it returns ZERO. SEE ALSO isalnum(). iscntrl()...g. otherwise it returns ZERO.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. ispunct(). RESULT If successful. isspace(). a punctuation character. that is neither a control character. MENU LIBRARIES isalpha int isalpha (int letter) HEADER ctype. ispunct(). a digit.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 is alphabetic. isalpha() returns a NON ZERO value. C99.htm (30 of 63) [21-06-2008 18:24:36] ctype. isxdigit(). isdigit(). RESULT If successful. islower(). MENU LIBRARIES iscntrl int iscntrl (int control_delete) HEADER PURPOSE file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. isxdigit(). an implementation defined character. or a space..

C99. isgraph(). isupper(). isxdigit(). isspace(). RESULT If successful. an implementation defined character which can be displayed) other than a space. isalpha(). ispunct(). ispunct(). C99. C99. isxdigit(). iscntrl().h PURPOSE To check whether the value passed to num is a digit between 0 and 9. MENU LIBRARIES islower file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. isupper(). isupper(). RESULT If successful..h PURPOSE To check whether the value passed to print. SEE ALSO isalnum(). isalpha(). SEE ALSO isalnum(). otherwise it returns ZERO. iscntrl() returns a NON ZERO value. isprint(). otherwise it returns ZERO.g an implementation defined character that is not printable) or the delete character..ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. isdigit() returns a NON ZERO value. isxdigit(). isprint(). otherwise it returns ZERO. isspace().g. isgraph(). islower(). MENU LIBRARIES isdigit int isdigit (int num) HEADER ctype.htm (31 of 63) [21-06-2008 18:24:36] . isdigit(). SEE ALSO isalnum(). isdigit(). RESULT If successful. isgraph() returns a NON ZERO value. isspace().A Dictionary of ANSI Standard C Function Definitions To check whether the value passed to control_delete. is either a control character (e. islower(). MENU LIBRARIES isgraph int isgraph (int print) HEADER ctype. is any printable character (e. isprint(). isalpha(). ispunct(). iscntrl(). islower().

A Dictionary of ANSI Standard C Function Definitions int islower (int ch) HEADER ctype.. iscntrl(). isupper(). isdigit(). SEE ALSO isalnum(). when using the 'C' locale. isdigit().htm (32 of 63) [21-06-2008 18:24:36] . otherwise it returns ZERO.h PURPOSE To check. islower(). isupper(). C99. ispunct() returns a NON ZERO value. In other words ANY printable character which is neither alphanumeric. isalpha(). whether the value passed to ch is a lower case letter. nor a space. otherwise it returns ZERO. isalpha(). MENU LIBRARIES ispunct int ispunct (int comma) HEADER ctype.. isspace(). isxdigit(). isgraph(). RESULT If successful. islower(). iscntrl(). isalpha(). isspace(). is a printable character (e. ispunct(). islower() returns a NON ZERO value. isgraph(). C99. isprint().h PURPOSE To check whether the value passed to comma is a punctuation character. isgraph(). isxdigit(). isspace(). RESULT If successful. isprint() returns a NON ZERO value.g an implementation defined character that can be displayed) or a space. isdigit(). otherwise it returns ZERO. iscntrl(). SEE ALSO isalnum().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. a control character. SEE ALSO isalnum(). file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. RESULT If successful.h PURPOSE To check whether the value passed to print. ispunct(). MENU LIBRARIES isprint int isprint (int print) HEADER ctype.

. C99.htm (33 of 63) [21-06-2008 18:24:36] . MENU LIBRARIES isspace int isspace (int space) HEADER ctype. isalpha(). iscntrl(). isxdigit().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. when using the 'C' locale. isspace() returns a NON ZERO value.A Dictionary of ANSI Standard C Function Definitions isupper(). SEE ALSO isalnum(). islower(). 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. C99 MENU LIBRARIES isupper file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.h PURPOSE To check. isgraph(). isprint(). isxdigit(). ispunct() isupper(). isdigit(). otherwise it returns ZERO..

isupper() returns a NON ZERO value.'f'. RESULT If successful labs() returns the absolute value of num. isxdigit() returns a NON ZERO value. isgraph(). isgraph(). MENU LIBRARIES isxdigit int isxdigit (int hex) HEADER ctype. RESULT If successful. and 'a' . otherwise the value returned is implementation defined. iscntrl(). ispunct(). islower(). positive ) value of num. NOTES The absolute value of a number can only be positive. SEE ALSO isalnum().g. isprint(). isspace(). isdigit().A Dictionary of ANSI Standard C Function Definitions int isupper (int ch) HEADER ctype. MENU LIBRARIES labs long int labs (long int num) HEADER stdlib.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. otherwise it returns ZERO. C99. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.h PURPOSE To check whether the value passed to ch is an upper case character.. ispunct(). isxdigit(). SEE ALSO isalnum(). C99. a decimal digit. isupper().h PURPOSE To calculate the absolute (e.h PURPOSE To check whether the value passed to hex is either a hexadecimal digit. RESULT If successful. or a letter between the ranges 'A' 'F'. isdigit(). isalpha(). isalpha().. otherwise it returns ZERO.htm (34 of 63) [21-06-2008 18:24:36] . islower(). iscntrl().

long rem.h PURPOSE To calculate the result and the remainder.h PURPOSE To calculate the value of num.. Or if the value is too large to fit inside a double. NOTES If the values passed to ldexp() are not a double precision number and an integer in that order. If the value is too small ldexp() returns 0. ldiv(). RESULT If successful ldiv() returns the result quot. long int divisor) HEADER stdlib. When a domain error occurs. a range error (an illegal return value) will occur. 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. an implementation defined value is returned. MENU LIBRARIES ldiv ldiv_t ldiv (long int num. contained inside the ldiv_t structure.A Dictionary of ANSI Standard C Function Definitions SEE ALSO abs(). div(). and the global integer errno set to EDOM. } file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. a domain error (an illegal return value) will result.HUGE_VAL. ldexp() returns the value of num multiplied by 2 to the power of exp.htm (35 of 63) [21-06-2008 18:24:36] . otherwise if the value returned by ldexp() is not a double.0. fabs(). multiplied by 2 to the value contained within exp. int exp) HEADER math. SEE ALSO frexp(). after the division of num by divisor. Otherwise the value returned is implementation defined. RESULT If successful. in either case errno is set to ERANGE. modf(). ldexp() returns + or ..ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. and the remainder rem. MENU LIBRARIES ldexp double ldexp (double num.

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. MENU LIBRARIES localeconv struct lconv *localeconv (void) HEADER locale. when used with money The character used to separate thousands.. with the numerical and monetary values of the current locale.htm (36 of 63) [21-06-2008 18:24:36] . RESULT localeconv() returns a pointer to the structure lconv. even though setlocale() can change the contents of the structure.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.A Dictionary of ANSI Standard C Function Definitions ldiv_t SEE ALSO div().h PURPOSE To initialise the structure lconv.. 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. NOTES localeconv() is called before setlocale().

. 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. when used with local currency. 2 The sign is behind both currency symbol and money. 1 The sign is in front of both currency symbol and money. Whether the currency symbol is (1). from a negative sum of money (otherwise 0).htm (37 of 63) [21-06-2008 18:24:36] .ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. Whether the currency symbol is separated by a space (1). Whether the currrency symbol comes before (1). Whether the currency symbol comes before (1) or (0) after a negative sum of money. 3 The sign is in front of the currency symbol.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. separated by a space from a sum of money (otherwise 0). or (0) after a sum of money. wherever it appears.. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. when used with international currency How many numbers are to be displayed after the decimal point. The position of the plus sign when used with currency. The position of the minus sign when used with currency.

Each time ctime() . the function time() must be called. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.0.. If the value is too small log() returns 0. SEE ALSO clock().htm (38 of 63) [21-06-2008 18:24:36] . otherwise the value returned is implementation defined. a range error (an illegal return value) will occur. RESULT If successful log() returns the natural logarithm of num. log() returns + or . or localtime() is called. NOTES Local time effects the time zone. The object time_t stores time as an implementation defined variable. SEE ALSO mblen(). RESULT If successful localtime() returns a pointer to the tm structure. When a domain error occurs. time().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. Or if the value is too large to fit inside a double. MENU LIBRARIES localtime struct tm *localtime (const time_t *num_seconds) HEADER time. and daylight savings time members of the tm structure. mbtowc(). wcstombs(). an implementation defined value is returned. If any of the structure members contain the value CHAR_MAX they are not available in the locale being used.. mbstowcs(). information within the tm structure may be overwritten.h PURPOSE To convert the calendar time pointed to by num_seconds into the local time zone. difftime(). in either case errno is set to ERANGE. To initialise the pointer num_seconds.h PURPOSE To calculate the natural logarithm of the value passed to num. gmtime() . wctomb(). this information is stored within a tm structure. MENU LIBRARIES log double log (double num) HEADER math.HUGE_VAL. otherwise if the value returned by log() is not a double.A Dictionary of ANSI Standard C Function Definitions 4 The sign is behind the currency symbol. wherever it appears.

0. SEE ALSO log(). in either case errno is set to ERANGE. and the global integer errno is set to EDOM. and ret_value the value returned by setjump() to the function which originally called it. NOTES If the value passed to num is not a double precision number. RESULT No values are returned by this function.. a domain error (an illegal argument) will occur. C99.. log10() returns + or . SEE ALSO log10. or is negative. RESULT If successful log10() returns the base 10 logarithm of the value passed to num. MENU LIBRARIES log10 double log10 (double num) HEADER math. Where stackinfo contains the information used to reset the stack.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. When a domain error occurs. an implementation defined value is returned. Or if the value is too large to fit inside a double. otherwise if the value returned by log10() is not a double. int ret_value) HEADER setjmp. NOTES file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. and the global integer errno is set to EDOM.h PURPOSE To enable the line of execution within a program to jump backwards from one function into another.HUGE_VAL. MENU LIBRARIES longjmp void longjmp (jmp_buf stackinfo.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 range error (an illegal return value) will occur. a domain error (an illegal argument) will occur.htm (39 of 63) [21-06-2008 18:24:36] . If the value is too small log10() returns 0.h PURPOSE To calculate the base 10 logarithm for num.

A Dictionary of ANSI Standard C Function Definitions In order to initialise stackinfo. this means it must not be called more than once within the program.h PURPOSE To allocate an area of memory from the heap. Functions which control error handling. and longjump(). the system may crash.. areas of memory allocated by malloc() are not initialised to ZERO.htm (40 of 63) [21-06-2008 18:24:36] . and program recovery. realloc(). If after longjmp() has finished. errors may occur. SEE ALSO free(). NOTES main() must NOT be called recursively. setjmp() must be called before longjmp(). where amount is the memory size. Information passed to the program through main() must use the following parameters: argc the number of items of information that are to be passed. MENU LIBRARIES main int main (void) or (int argc. RESULT main() can return the values EXIT_FAILURE or EXIT_SUCCESS once they have been passed by exit(). normally the operating systems command line. often use setjump(). NOTES If malloc() does return NULL and it remains undetected. *argv[] a pointer to an array of character pointers. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. char *argv[]) HEADER stdio.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. Unlike calloc(). the program is unable to move back to the statement following the call to setjmp() that defined stackinfo.h PURPOSE To provide a start point within a 'C' program. MENU LIBRARIES malloc void *malloc (size_t amount) HEADER stdlib.. otherwise it returns the macro NULL (a NULL pointer). RESULT If successful malloc() returns a generic pointer to the area of memory allocated. all other functions are called from inside main().

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

A Dictionary of ANSI Standard C Function Definitions MENU LIBRARIES mbtowc int mbtowc (wchar_t * w_ch.. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. memset(). 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. SEE ALSO localeconv(). 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. strcspn(). wctomb(). NOTES memchr() converts ch into an unsigned char. strpbrk().h PURPOSE To convert the multibyte character pointed to by m_byte into a wide character. SEE ALSO memcmp(). Otherwise it returns -1 in the case of an error during conversion where mbtowc() stores EILSEQ inerrno. mbstowcs(). RESULT If successful. memcpy(). MENU LIBRARIES memchr void *memchr(const void *string. setlocale(). otherwise it returns the macro NULL (a NULL pointer). mbtowc() is effected by changes to the LC_CTYPE category of the current locale. const char *m_byte. memmove(). strstr(). int ch. where count is the length of that array. Or -2 if mbtowc() processed an incomplete multibyte character. size_t count) HEADER string. strspn(). memchr() returns a generic pointer to the first array element containing ch. size_t length) HEADER stdlib. wcstombs().htm (42 of 63) [21-06-2008 18:24:36] . whose length is the number of bytes within the array. strrchr().strchr(). mblen().h PURPOSE To search the character array pointed to by string for the character passed to ch..

strcmp(). RESULT If successful memcpy() returns a generic pointer containing the destination address. const void *from. size_t width) HEADER string. strncmp(). MENU LIBRARIES memcpy void *memcpy(void *to.A Dictionary of ANSI Standard C Function Definitions MENU LIBRARIES memcmp int memcmp (const void *area1.h PURPOSE To copy information from the area of memory pointed to by from. 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(). with the area of memory pointed to by area2. const void *area2. strcoll().htm (43 of 63) [21-06-2008 18:24:36] ..ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. SEE ALSO memchr(). memset(). memcpy(). into the area of memory pointed to by to.h PURPOSE To compare the area of memory pointed to by area1.. Both of which are at least width number of characters long. memmove(). Where width contains the length of the information in bytes. size_t width) HEADER string.

information may be overwritten before it is copied.. const void *from. memcmp(). int ch. MENU LIBRARIES memset void *memset (void *buffer. NOTES One of the common uses of memset(). NOTES Unlike memcpy(). MENU LIBRARIES memmove void *memmove (void *to. memset().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. memmove() will . strcpy(). size_t count) HEADER string. size_t width) HEADER string. memmove(). memcpy().h PURPOSE To copy information from the area of memory pointed to by from. MENU LIBRARIES file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. SEE ALSO memchr(). SEE ALSO memchr(). into count number of elements of the array pointed to by buffer. RESULT If successful. if areas of memory overlap. copy information before it is overwritten. memset() returns a generic pointer containing the address of *buffer.A Dictionary of ANSI Standard C Function Definitions NOTES Unlike memmove().htm (44 of 63) [21-06-2008 18:24:36] . memset() converts ch to an unsigned char.. SEE ALSO memchr(). strncpy(). if areas of memory overlap.h PURPOSE To copy the low order byte of the value passed to ch. into the area of memory pointed to by to. RESULT If successful memmove() returns a generic pointer containing the destination address. memcmp(). strncpy(). memcmp(). memset(). is to initialise a region of memory to a known value. Where width contains the length of the information in bytes. strcpy().

h PURPOSE To convert the local time contained within a tm structure into calendar time. Otherwise it returns (time_t)-1. RESULT If successful modf() returns the signed fractional component of num. NOTES If the values passed to modf() are not double precision numbers. dates before 1980 may cause mktime() to return (time_t)-1. Or if the value is too large to fit inside a double. modf() returns + or . When a domain error occurs.. The tm_wday and tm_yday members of the tm structure are changed by this function. If the value is too small modf() returns 0.0. NOTES To initialise the tm structure. ldexp(). When using either MSDOS or OS/2. RESULT If successful. double *whole) HEADER math. in either case errno is set to ERANGE. MENU LIBRARIES modf double modf (double num. difftime(). a range error (an illegal return value) will occur. time().h PURPOSE To convert the value passed to num into its whole number and fractional component parts. localtime() must be called first. mktime() returns the calendar time as a variable of type time_t. an implementation defined value is returned. otherwise if the value returned by modf() is not a double. an implementation defined variable.. The object time_t stores time as SEE ALSO clock(). placing its whole number component into the double pointed to by whole.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. a domain error (an illegal argument) will occur setting the global integer errno to EDOM. SEE ALSO frexp().HUGE_VAL.A Dictionary of ANSI Standard C Function Definitions mktime time_t mktime (struct tm *local) HEADER time.htm (45 of 63) [21-06-2008 18:24:36] . MENU LIBRARIES file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.

MENU LIBRARIES pow double pow (double base. strerror(). and the beginning of structure_member. double exp) HEADER math. feof(). and whatever error message is linked to the global integer errno SEE ALSO clearerr(). its behaviour is implementation defined. SEE ALSO sizeof MENU LIBRARIES perror void perror (const char *string) HEADER stdio.. NOTES If structure_member contains a bit-field. or the character pointed to by string is '\0'. followed by ':'.A Dictionary of ANSI Standard C Function Definitions offsetof size_t offsetof (structure_name.h PURPOSE To send error messages to stderr (the standard error device). containing the number of bytes between the start point of structure_name. structure_member) HEADER stddef. consisting of text obtained from the character array *string.h PURPOSE A macro which measures the distance between structure_name. RESULT offsetof() is a macro which expands to an integral constant expression of type size_t. ferror(). NOTES Unless string contains the value NULL .htm (46 of 63) [21-06-2008 18:24:36] .ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.h file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. and structure_member. An appropriate error message will be displayed. RESULT No values are returned by this function..

otherwise if the value returned by pow() is not a double. Where *format defines the type of printable character contained in argument.HUGE_VAL.. If the value is too small pow() returns 0.A Dictionary of ANSI Standard C Function Definitions PURPOSE To calculate the value of base raised to the power of exp.0. a range error (an illegal return value) will occur. optionally it can contain format tags that are substituted by the values specified in argument. log().' indicates a flexible number of arguments. log10(). C99. Or if the value is too large to fit inside a double. These tags must be equal in number to the arguments used. RESULT If successful pow() returns the value of base raised to the power of exp. MENU LIBRARIES printf int printf (const char *format. NOTES If the values passed to pow() are not double precision numbers. SEE ALSO exp(). and the global integer errno set to EDOM. in either case errno is set to ERANGE... Or base contains a negative value. usually the video screen.h PURPOSE To format and send printable characters to the standard output device (stdout).. [argument]. and exp is not an integer. Then a domain error (an illegal argument) will occur. *format may contain some or all of the following information in this order: % [MODIFIER] [WIDTH] [. sqrt(). Otherwise it returns a negative value. Values greater than 2 to the power of 64 cannot be computed by pow(). When a domain error occurs. which can be optional. PRECISION] [TAG] TEXT MODIFIER Specifies the type of character conversion or alignment file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. Or if the value of base is ZERO. an implementation defined value is returned..htm (47 of 63) [21-06-2008 18:24:36] . and the value of exp is less than or equal to ZERO.. and '. RESULT If successful printf returns the number of characters sent to stdout. NOTES *format contains the text to be printed.) HEADER stdio. pow() returns + or .ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions..

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]

.htm (51 of 63) [21-06-2008 18:24:36] .ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.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. getc(). putchar(). fgets(). sscanf(). MENU LIBRARIES putc int putc (int ch. Otherwise it returns EOF. sprintf(). ungetc(). ungetc().fputs(). putchar() returns the numerical value of the value written. scanf(). SEE ALSO fgetc(). RESULT If successful putc() returns the numerical value of the character written to the file. fprintf(). putchar() may also be implemented by a macro using fputc().. SEE ALSO fgetc(). NOTES Use ferror() to check for errors. gets(). puts(). gets(). getchar().h PURPOSE To write a character to the file pointed to by file_pointer. getchar(). NOTES Use ferror() to check for errors. MENU LIBRARIES putchar int putchar (int ch) HEADER stdio. FILE *file_pointer) HEADER stdio. putc(). MENU LIBRARIES file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. puts().A Dictionary of ANSI Standard C Function Definitions \ooo Up to three digit octal number SEE ALSO fscanf(). RESULT If successful. fgets(). fputc(). fputs(). putc() may also be implemented by a macro using fputc().h PURPOSE To write a character to stdout (the standard output device). usually the video screen. C99 . otherwise it returns EOF..htm (52 of 63) [21-06-2008 18:24:36] . getc().

htm (53 of 63) [21-06-2008 18:24:36] . Unlike fputs().h PURPOSE To sort the array pointed to by buffer. puts() appends a new line to the output string. key and elem point to two separate elements within the array.A Dictionary of ANSI Standard C Function Definitions puts int puts (const char *string) HEADER stdio. getchar()..h PURPOSE To write a string to stdout (the standard output device). int (*compare)( const void *key. fgets(). which carries out the comparison. SEE ALSO fgetc(). RESULT If sucessful puts() returns a positive value. ungetc(). usually the video screen. putc().. RESULT No values are returned by qsort(). fputc(). otherwise it returns EOF. In other words whenever puts() encounters a '\0' character it replaces it with '\n'. *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. compare points to a user defined function. size_t length.. getc().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. size_t width. gets(). MENU LIBRARIES qsort void qsort (void *buffer. NOTES Use ferror() to check for errors. putchar(). Where length is the number of individual elements within the array. const void *elem)) HEADER stdlib. and width their size in bytes.

htm (54 of 63) [21-06-2008 18:24:36] . RESULT If successful raise() returns ZERO. Any signal handler called by raise(). MENU LIBRARIES rand int rand (void) HEADER stdlib.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. SEE ALSO bsearch(). The value of RAND_MAX must be at least 32767. Otherwise it returns a NON ZERO value.. after srand() has been called. what counts as the "lowest" depends on the values returned by *compare(). If some of the elements contain the same value. RESULT rand() returns a number between ZERO and RAND_MAX.h PURPOSE To cause a function previously installed by signal() to be called. assert(). NOTES raise() may be used to check. must finish before raise() can return a value. they will NOT be sorted properly. containing a value linked to that signal handler. is sent to the operating system. In other words the array could be sorted in descending order by reversing the values returned for greater than and less than. SEE ALSO abort(). with the lowest element containing the lowest value. MENU LIBRARIES raise int raise (int sig_num) HEADER signal.h PURPOSE To generate a sequence of pseudo random numbers. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. whether functions installed by signal() are working correctly..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. signal(). Where sig_num.

SEE ALSO rename(). the actions carried out by this function are implementation defined. otherwise it returns the macro NULL (a NULL pointer).h PURPOSE To erase the file whose name is the string pointed to by file_name.htm (55 of 63) [21-06-2008 18:24:36] . malloc().. RESULT If successful realloc() returns a generic pointer to an area of memory. MENU LIBRARIES rename int rename(const char *old_name. malloc(). the value passed to new_size must be ZERO. otherwise it returns NON ZERO. Where memory_ptr points to an area of memory. MENU LIBRARIES remove int remove (const char *file_name) HEADER stdio. NOTES If the file is open when remove() is called.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. size_t new_size) HEADER stdlib.A Dictionary of ANSI Standard C Function Definitions MENU LIBRARIES realloc void *realloc (void *memory_ptr. previously allocated by an earlier call to calloc(). or realloc(). RESULT If successful remove() returns ZERO. const char *new_name) file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.. and new_size contains the number of bytes you wish to allocate. tmpfile().h PURPOSE To change the amount of memory already allocated. SEE ALSO calloc(). free(). NOTES If you wish to free the area of memory completely.

. rename() returns ZERO.. a read may not be followed by a write. which only resets the EOF flag.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. NOTES rewind() also resets the EOF and ERROR flags.htm (56 of 63) [21-06-2008 18:24:36] . RESULT If successful. to the beginning of the file pointed to by file_pointer.' indicates a flexible number of arguments. Where argument contains the memory address used to store that information.h PURPOSE To enable information to enter a program through stdin (the standard input device). format points to the type of alpha numeric or printable character contained in argument. SEE ALSO remove().A Dictionary of ANSI Standard C Function Definitions HEADER stdio. and new_name to the one you wish to insert in its place. otherwise it returns a NON ZERO value.h PURPOSE To change the name of a file.. linked to *file_pointer.. without first calling either fflush(). or rewind. MENU LIBRARIES rewind void rewind (FILE *file_pointer) HEADER stdio. Unless the length of *new_name is implementation defined.argument] . and '.h PURPOSE To move the file position indicator. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. NOTES If the filename pointed to by new_name already exists. ftell().) HEADER stdio. where old_name points to the files present name. the actions of the function are implementation defined. MENU LIBRARIES scanf int scanf (const char *format [. fsetpos(). If the file has been opened for read/write.. tmpfile(). Or vice versa. unlike fseek().. FILENAME_MAX will be the recommended size of the array. fseek(). SEE ALSO fgetpos().. RESULT No value is returned by this function.

ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.htm (57 of 63) [21-06-2008 18:24:36] . scanf() returns the number of variables correctly read.A Dictionary of ANSI Standard C Function Definitions RESULT If successful.. that may be used in the string pointed to by format. call either feof() or ferror(). or EOF in the event of an error.. To check whether the EOF character has been reached. otherwise it returns ZERO if no characters were read. NOTES The following are some of the conversion specifications. *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 (58 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..

MENU LIBRARIES setbuf void setbuf (FILE *file_pointer. which scanf() a string. then scanf() will cease reading the string. vfprintf(). vprintf() vsprintf(). char *buffer) HEADER stdio. SEE ALSO C99 . printf(). looks for when reading On finding one of these characters it finishes. with the open file pointed to by file_pointer. 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).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.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions.h PURPOSE To link the character array pointed to by buffer. returning a pointer to that part of the string. when it finds a character not contained in the scanset. Modern programs use the function setvbuf() instead. fscanf(). to jump back to setjump() 's position in the programs execution. sscanf().h PURPOSE To save the contents of the stack. C99 . SEE ALSO fprintf(). file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.htm (59 of 63) [21-06-2008 18:24:36] .. If ^ is the first character within the scanset. into the buffer environ_buf.. RESULT No values are returned by this function. MENU LIBRARIES setjmp int setjmp (jmp_buf environ_buf) HEADER setjmp. this information is then used by longjmp().

towctrans() . setjmp(). Or to recognise decimal numbers.h PURPOSE To change the dates. will return ZERO. RESULT If successful. Both functions are used to call error handling or program recovery functions. setjmp() will return a NON ZERO value. otherwise setlocale() returns NULL. once longjmp() has been called and finished its execution. NOTES After longjmp() has finished. const char *locale) HEADER locale. which use a comma instead of a decimal point. wctype() LC_MONETARY Modifies currency file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.h .A Dictionary of ANSI Standard C Function Definitions RESULT If successful.. strfxfrm LC_CTYPE Modifies character functions in ctype. monetary values.htm (60 of 63) [21-06-2008 18:24:36] .. after saving the contents of the stack. MENU LIBRARIES setlocale char *setlocale (int category. However.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. setlocale() will return a pointer linked to the locale currently being used. setjmp() then returns the value passed to it by longjmp(). When the value of *locale is the macro NULL (a NULL pointer). setlocale() returns a pointer to the string linked to category. NOTES One of the following values must be used by category: LC_ALL Modifies all location categories LC_COLLATE Modifies strcoll() () . for instance to enable a program to understand the Russian alphabet. execution will move to the next statement after setjmp(). and the C99 wide character classification functions iswctype() . and types of alpha numeric characters that a program will accept. wctrans() . If longjmp() passes ZERO.

Where width is the length of the array in bytes. with the file pointed to by file pointer. NOTES If the value contained within *buffer is the macro NULL (a NULL pointer). access_mode may contain one of the following: _IOFBF _IOLBF Full input/output buffering.ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. Otherwise it will return a NON ZERO value... Buffer is flushed each time a new line is entered. size_t width) HEADER stdio.int access_mode. Any buffer created by YOU the programmer does not need to be BUFSIZ (at least 256) characters long.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(). char *buffer. when it is full. MENU LIBRARIES setvbuf int setvbuf (FILE *file_pointer. setvbuf() returns ZERO. No buffering takes place. or when it is read. C99 MENU LIBRARIES signal file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. time(). _IONBF SEE ALSO setbuf(). and access_mode contains that files particular mode of access. RESULT If successful. setvbuf() will choose its own buffer. (information is read or written directly to and from the file).htm (61 of 63) [21-06-2008 18:24:36] .h PURPOSE To link the character array pointed to by buffer.

The value contained in signal_num must be one of the following: SIGABRT SIGFPE SIGINT SIGSEGV SIGTERM SIGILL Abnormal exit produced by calling abort(). otherwise it returns SIG_ERR and a positive value is stored in errno. Ignore this signal. from outside the program. or longjmp(). If this function receives the value contained in signal_num. signal() is used to test interrupt handler functions. Interupt signal received. as a signal handler. or one of the following: SIG_DFL SIG_IGN Use the default signal handler. it may call abort(). NOTES Under MSDOS. Floating point error caused by dividing a number by ZERO. The value passed to *sig_handler(). the program will continue execution at the point where it was interrupted. this usually terminates the program.void (*sig_handler)(int signal_num))) (int ret_value) HEADER signal.. An illegal instruction. Segment error caused by faulty memory allocation. must be either the address of the signal handler function. SEE ALSO assert().A Dictionary of ANSI Standard C Function Definitions void (*signal (int signal_num. its actions will vary from one piece of hardware to another. it will be activated. Terminate this program. file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2. Or is called by raise(). Lastly this function is not clearly defined within the ANSI Standard.. raise(). Otherwise. or underflow.h PURPOSE To record the function pointed to by sig_handler(). possibly from the keyboard.htm (62 of 63) [21-06-2008 18:24:36] . RESULT If successful. exit().ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions. If *sig_handler() itself returns a value. unless the value of signal_num was SIGFPE or an implementation defined value. *sig_handler() returns the previous value of sig_handler. a data overflow.

file:///G|/learning/Books%20Computer/Ultimate%20C%20Material/A%2.htm (63 of 63) [21-06-2008 18:24:36] .h PURPOSE To calculate the sine of the double precision value passed to angle.A Dictionary of ANSI Standard C Function Definitions MENU LIBRARIES sin double sin (double angle) HEADER math..ctionary%20of%20ANSI%20Standard%20C%20Function%20Definitions..