一份c语言函数清单

类别:编程语言 点击:0 评论:0 推荐:
http://www.phim.unibe.ch/comp_doc/c_manual/C/FUNCTIONS/funcref.htm

This is a summary of ANSI and POSIX functions grouped by library. If you want an alphabetical list, please use the master index. Please refer to a manual for a complete list of functions available to you.

ANSI standard library. POSIX library. Non Standard functions from CONIO.H Non ANSI Standard Unix functions User written functions. Variable length argument lists.

ANSI standard library.The ANSI library is declared in the following header files.

assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stddef.h stdio.h stdlib.h string.h time.h

POSIX libraryThe POSIX library contains the following headers.

cpio.h dirent.h fcntl.h grp.h pwd.h sys/stat.h sys/times.h sys/types.h sys/utsname.h sys/wait.h tar.h termios.h unistd.h utime.h

ANSII Library headers assert.h Line("man", "../MAN/assert.htm", "assert", ""); assert ctype.h Line("whiteball", "../EXAMPLES/is_examp.c", "isalnum", "Checks whether a character is alphanumeric (A-Z, a-z, 0-9)"); Line("whiteball", "../EXAMPLES/is_examp.c", "isalpha", ""); Line("whiteball", "../EXAMPLES/is_examp.c", "iscntrl", "Checks whether a character is a control character or delete ( decimal 0-31 and 127)"); Line("whiteball", "../EXAMPLES/is_examp.c", "isdigit", "Checks whether a character is a digit (0-9)"); Line("whiteball", "../EXAMPLES/is_examp.c", "isgraph", "Checks whether a character is a printable character, excluding the space (decimal 32)"); Line("whiteball", "../EXAMPLES/is_examp.c", "islower", "Checks whether a character is a lower case letter (a-z)."); Line("whiteball", "../EXAMPLES/is_examp.c", "isprint", "Checks whether a character is printable (decimal 32-126)."); Line("whiteball", "../EXAMPLES/is_examp.c", "ispunct", "Checks whether a character is punctuation (decimal 32-47, 58-63, 91-96, 123-126)"); Line("whiteball", "../EXAMPLES/is_examp.c", "isspace", "Checks whether a character is white space - space, CR HT VT NL, FF."); Line("whiteball", "../EXAMPLES/is_examp.c", "isupper", "Checks whether a character is an upper case letter (A-Z)."); Line("whiteball", "../EXAMPLES/is_examp.c", "isxdigit", "Checks whether a character is hex digit (0-9, A-F, a-f)."); Line("man", "../MAN/toupper.htm", "toupper", "Converts a lowercase character to uppercase."); Line("man", "../MAN/toupper.htm", "tolower", "Convert an uppercase character to lowercase."); isalnum Checks whether a character is alphanumeric (A-Z, a-z, 0-9) isalpha iscntrl Checks whether a character is a control character or delete ( decimal 0-31 and 127) isdigit Checks whether a character is a digit (0-9) isgraph Checks whether a character is a printable character, excluding the space (decimal 32) islower Checks whether a character is a lower case letter (a-z). isprint Checks whether a character is printable (decimal 32-126). ispunct Checks whether a character is punctuation (decimal 32-47, 58-63, 91-96, 123-126) isspace Checks whether a character is white space - space, CR HT VT NL, FF. isupper Checks whether a character is an upper case letter (A-Z). isxdigit Checks whether a character is hex digit (0-9, A-F, a-f). toupper Converts a lowercase character to uppercase. tolower Convert an uppercase character to lowercase. errno.h Line("man", "../FUNCTIONS/errno.htm", "errno", ""); errno float.hNo functions are declared in stddef.h. limits.hNo functions are declared in stddef.h. locale.h Line("man", "../MAN/setlocale.htm", "setlocale", ""); setlocale math.h Line("man", "../MAN/acos.htm", "acos", ""); Line("man", "../MAN/asin.htm", "asin", ""); Line("man", "../MAN/atan.htm", "atan", ""); Line("man", "../MAN/atan2.htm", "atan2", ""); Line("man", "../MAN/ceil.htm", "ceil", "smallest integral value not less than x"); Line("man", "../MAN/cos.htm", "cos", "Cosine."); Line("man", "../MAN/cosh.htm", "cosh", ""); Line("man", "../MAN/exp.htm", "exp", ""); Line("man", "../MAN/fabs.htm", "fabs", "absolute value of floating-point number"); Line("man", "../MAN/floor.htm", "floor", "largest integral value not greater than x"); Line("man", "../MAN/fmod.htm", "fmod", "floating-point remainder function"); Line("man", "../MAN/frexp.htm", "frexp", ""); Line("man", "../MAN/ldexp.htm", "ldexp", ""); Line("man", "../MAN/exp.htm", "log", ""); Line("man", "../MAN/exp.htm", "log10", ""); Line("man", "../MAN/modf.htm", "modf", ""); W(""); Line("man", "../MAN/exp.htm", "pow", "Raise a number by a power."); Line("man", "../MAN/sin.htm", "sin", "The sine of an integer."); Line("man", "../MAN/sinh.htm", "sinh", ""); W(""); Line("man", "../MAN/sqrt.htm", "sqrt", "Square root of a number."); Line("man", "../MAN/tan.htm", "tan", "Tangent."); Line("man", "../MAN/tanh.htm", "tanh", "Hyperbolic tangent."); acos asin atan atan2 ceil smallest integral value not less than x cos Cosine. cosh exp fabs absolute value of floating-point number floor largest integral value not greater than x fmod floating-point remainder function frexp ldexp log log10 modf pow Raise a number by a power. sin The sine of an integer. sinh sqrt Square root of a number. tan Tangent. tanh Hyperbolic tangent. NoteFor some reason abs is in stdlib.h setjmp.h Line("man", "../MAN/setjmp.htm", "setjmp", ""); Line("man", "../MAN/longjmp.htm", "longjmp", ""); setjmp longjmp signal.h Line("man", "../MAN/signal.htm", "signal", ""); Line("man", "../MAN/raise.htm", "raise", ""); signal raise stdarg.h Line("man", "../MAN/va_start.htm", "va_start", ""); Line("man", "../MAN/va_start.htm", "va_arg", ""); Line("man", "../MAN/va_start.htm", "va_end", ""); Line("whiteball", "../SYNTAX/functions.html#2.7", "An example of use", ""); va_start va_arg va_end An example of use

See also vprintf vfprintf and vsprintf which all print the contents of a va_list

stddef.hNo functions are declared in stddef.h. stdio.hThis header defines all the ANSI I/O functions that allow you to read and write to files and devices. Low level (non ANSI) functions are also available.

Line("man", "../MAN/ferror.htm", "clearerr", ""); Line("whiteball", "fclose.html", "fclose", "Close a file."); Line("whiteball", "../EXAMPLES/continue.c", "feof", "Check for EOF while reading a file."); Line("man", "../MAN/fflush.htm", "fflush", ""); Line("whiteball", "fgetc.html", "fgetc", "Read a character from a file."); Line("man", "../MAN/fgetpos.htm", "fgetpos", ""); Line("whiteball", "fgets.html", "fgets", "Read a record from a file (safer than fgetc)."); Line("whiteball", "fopen.html", "fopen", "Open a file"); Line("whiteball", "fprintf.html", "fprintf", "O/P a line of data to a file."); Line("whiteball", "files.html", "fputc", "Put a charater into a file."); Line("whiteball", "files.html", "fputs", "Put a string into a file."); Line("man", "../MAN/fread.htm", "fread", ""); Line("man", "../MAN/freopen.htm", "freopen", ""); Line("man", "../MAN/fscanf.htm", "fscanf", ""); Line("man", "../MAN/fgetpos.htm", "fseek", ""); Line("man", "../MAN/fgetpos.htm", "fsetpos", ""); Line("man", "../MAN/fgetpos.htm", "ftell", ""); Line("man", "../MAN/fread.htm", "fwrite", ""); Line("whiteball", "fgetc.html", "getc", "Get a character from an input stream."); Line("whiteball", "getchar.html", "getchar", "Get a character from the keyboard (STDIN)."); Line("whiteball", "gets.html", "gets", "Get string (from keyboard)."); Line("man", "../MAN/perror.htm", "perror", ""); Line("whiteball", "printf.html", "printf", "O/P data to the screen or a file."); Line("man", "../MAN/puts.htm", "putchar", "O/P a character to STDOUT."); Line("whiteball", "puts.html", "puts", "O/P data to the screen or a file."); Line("man", "../MAN/remove.htm", "remove", "Remove a file."); Line("man", "../MAN/fgetpos.htm", "rewind", ""); Line("man", "../MAN/scanf.htm", "scanf", ""); Line("man", "../MAN/setbuf.htm", "setbuf", ""); Line("man", "../MAN/setvbuf.htm", "setvbuf", ""); Line("whiteball", "sprintf.html", "sprintf", "O/P data in tha same way as 'printf' but put it into a string."); Line("whiteball", "sscanf.html", "sscanf", "Extract fields from a string."); Line("man", "../MAN/tmpfile.htm", "tmpfile", ""); Line("man", "../MAN/tmpnam.htm", "tmpnam", ""); Line("man", "../MAN/gets.htm", "ungetc", ""); Line("man", "../MAN/vfprintf.htm", "vfprintf", "O/P a va_list to a file."); Line("man", "../MAN/vfprintf.htm", "vprintf", "O/P a va_list to stdout."); Line("man", "../MAN/vfprintf.htm", "vsprintf", "O/P a va_list to a string.");

clearerr fclose Close a file. feof Check for EOF while reading a file. fflush fgetc Read a character from a file. fgetpos fgets Read a record from a file (safer than fgetc). fopen Open a file fprintf O/P a line of data to a file. fputc Put a charater into a file. fputs Put a string into a file. fread freopen fscanf fseek fsetpos ftell fwrite getc Get a character from an input stream. getchar Get a character from the keyboard (STDIN). gets Get string (from keyboard). perror printf O/P data to the screen or a file. putchar O/P a character to STDOUT. puts O/P data to the screen or a file. remove Remove a file. rewind scanf setbuf setvbuf sprintf O/P data in tha same way as 'printf' but put it into a string. sscanf Extract fields from a string. tmpfile tmpnam ungetc vfprintf O/P a va_list to a file. vprintf O/P a va_list to stdout. vsprintf O/P a va_list to a string. stdlib.h Line("whiteball", "abort.htm", "abort", "a program."); Line("man", "../MAN/abs.htm", "abs", "compute the absolute value of an integer."); Line("whiteball", "atexit.htm", "atexit", "Execute the named function when the program terminates."); Line("whiteball", "atof.html", "atof", "convert a string to a double"); Line("whiteball", "../EXAMPLES/exponent.c#atoi", "atoi", "Accepts +-0123456789 leading blanks and converts to integer."); Line("whiteball", "atol.html", "atol", "convert a string to a long integer"); Line("whiteball", "bsearch.html", "bsearch", "Binary chop."); Line("man", "../MAN/calloc.htm", "calloc", "memory for an array."); Line("man", "../MAN/div.htm", "div", "compute the quotient and remainder of integer division"); Line("whiteball", "exit.html", "exit", "Normally terminate a program."); Line("whiteball", "env.html", "getenv", "Get an environmental variable."); Line("whiteball", "free.html", "free", "memory allocated with malloc."); Line("man", "../MAN/labs.htm", "labs", "compute the absolute value of a long integer"); Line("man", "../MAN/div.htm", "ldiv", "compute the quotient and remainder of long integer division."); Line("whiteball", "malloc.html", "malloc", "dynamically allocate memory."); Line("man", "../MAN/mblen.htm", "mblen", "determine the number of bytes in a character"); Line("man", "../MAN/mbstowcs.htm", "mbstowcs", "convert a multibyte string to a wide character string."); Line("man", "../MAN/mbtowc.htm", "mbtowc", "convert a multibyte character to a wide character"); Line("whiteball", "qsort.html", "qsort", "Sort an array."); Line("whiteball", "rand.html", "rand", "Generate a random number."); Line("man", "../MAN/realloc.htm", "realloc", "Reallocate memory."); Line("man", "../MAN/strtod.htm", "strtod", "Convert a string to a double."); Line("whiteball", "strtol.html", "strtol", "String to long integer conversion. Takes data in various number bases."); Line("whiteball", "strtoul.html", "strtoul", "Convert a string to an unsigned long. This can also perform number base conversion."); Line("whiteball", "srand.html", "srand", "Seed a random number."); Line("whiteball", "system.html", "system", "Issue a command to the operating system"); Line("man", "../MAN/wctomb.htm", "wctomb", "convert a wide character to a multibyte character."); Line("man", "../MAN/wcstombs.htm", "wcstombs", "convert a wide character string to a multibyte character string."); abort a program. abs compute the absolute value of an integer. atexit Execute the named function when the program terminates. atof convert a string to a double atoi Accepts +-0123456789 leading blanks and converts to integer. atol convert a string to a long integer bsearch Binary chop. calloc memory for an array. div compute the quotient and remainder of integer division exit Normally terminate a program. getenv Get an environmental variable. free memory allocated with malloc. labs compute the absolute value of a long integer ldiv compute the quotient and remainder of long integer division. malloc dynamically allocate memory. mblen determine the number of bytes in a character mbstowcs convert a multibyte string to a wide character string. mbtowc convert a multibyte character to a wide character qsort Sort an array. rand Generate a random number. realloc Reallocate memory. strtod Convert a string to a double. strtol String to long integer conversion. Takes data in various number bases. strtoul Convert a string to an unsigned long. This can also perform number base conversion. srand Seed a random number. system Issue a command to the operating system wctomb convert a wide character to a multibyte character. wcstombs convert a wide character string to a multibyte character string. string.h Line("man", "../MAN/memchr.htm", "memchr", "Copy a character into memory."); Line("man", "../MAN/memcmp.htm", "memcmp", "Compare memory locations."); Line("whiteball", "memcpy.htm", "memcpy", "Copy memory."); Line("man", "../MAN/memmove.htm", "memmove", "Move memory."); Line("man", "../MAN/memset.htm", "memset", "Set memory."); Line("man", "../MAN/strcat.htm", "strcat", "Concatinate two strings."); W(""); Line("whiteball", "strchr.html", "strchr", "Search for a character in a string."); Line("whiteball", "strcmp.html", "strcmp", "Compare strings."); Line("man", "../MAN/strcoll.htm", "strcoll", ""); Line("whiteball", "strcpy.html", "strcpy", "Copy strings."); Line("man", "../MAN/strcspn.htm", "strcspn", ""); Line("man", "../MAN/strerror.htm", "strerror", ""); Line("whiteball", "strlen.html", "strlen", "Length of a string."); Line("man", "../MAN/strcat.htm", "strncat", "Concatinate two strings."); Line("whiteball", "strncmp.html", "strncmp", "Compare two strings."); Line("whiteball", "strncpy.html", "strncpy", "Copy part of a string."); Line("whiteball", "strpbrk.html", "strpbrk", ""); Line("whiteball", "strchr.html", "strrchr", "Search for a character in a string."); Line("man", "../MAN/strspn.htm", "strspn", ""); Line("whiteball", "strstr.html", "strstr", "Search a string for a substring."); Line("whiteball", "strtok.html", "strtok", "The books say this function splits a string into tokens. I think its function is best described as parsing a string."); Line("whiteball", "time.html", "strxfrm", ""); memchr Copy a character into memory. memcmp Compare memory locations. memcpy Copy memory. memmove Move memory. memset Set memory. strcat Concatinate two strings. strchr Search for a character in a string. strcmp Compare strings. strcoll strcpy Copy strings. strcspn strerror strlen Length of a string. strncat Concatinate two strings. strncmp Compare two strings. strncpy Copy part of a string. strpbrk strrchr Search for a character in a string. strspn strstr Search a string for a substring. strtok The books say this function splits a string into tokens. I think its function is best described as parsing a string. strxfrm time.h Line("man", "../MAN/asctime.htm", "asctime", ""); Line("man", "../MAN/clock.htm", "clock", ""); Line("man", "../MAN/asctime.htm", "ctime", ""); Line("man", "../MAN/difftime.htm", "difftime", ""); Line("man", "../MAN/asctime.htm", "gmtime", ""); Line("man", "../MAN/asctime.htm", "localtime", ""); Line("man", "../MAN/asctime.htm", "mktime", ""); Line("man", "../MAN/strftime.htm", "strftime", ""); Line("man", "../MAN/time.htm", "time", ""); Line("computer", "../EXAMPLES/time.c", "Example", "program using some of the time functions."); asctime clock ctime difftime gmtime localtime mktime strftime time Example program using some of the time functions. POSIX functions start here.... cpio.h dirent.h Line("whiteball", "directory.html", "opendir", "Open a directory."); Line("whiteball", "directory.html", "closedir", "Close a directory."); Line("whiteball", "directory.html", "readdir", "Read a directory entry."); Line("whiteball", "directory.html", "rewinddir", "Return to the beginning of a directory."); Line("whiteball", "directory.html", "scandir", "Scan a directory for a matching entry."); Line("whiteball", "directory.html", "seekdir", "Move to an offset in a directory."); Line("whiteball", "directory.html", "telldir", "Return the location within a directory."); opendir Open a directory. closedir Close a directory. readdir Read a directory entry. rewinddir Return to the beginning of a directory. scandir Scan a directory for a matching entry. seekdir Move to an offset in a directory. telldir Return the location within a directory. fcntl.h grp.h pwd.h sys/stat.h sys/times.h sys/types.h sys/utsname.h sys/wait.h tar.h termios.h unistd.hIt seems that this library contains headers for many functions that originally came with the ANSII standard library but did not have headers. My documentation for this POSIX library is incomplete. Line("man", "../MAN/access.htm", "access", ""); Line("man", "../MAN/alarm.htm", "alarm", ""); Line("man", "../MAN/chdir.htm", "chdir", "Change the current working directory."); Line("man", "../MAN/chown.htm", "chown", "Change the ownership of a file."); Line("whiteball", "../FUNCTIONS/close.html", "close", "Close a file (see low level functions)"); Line("man", "../MAN/chroot.htm", "chroot", "Change the root directory I am not 100% sure this is supposed to be in unistd."); Line("man", "../MAN/ctermid.htm", "ctermid", ""); Line("man", "../MAN/cuserid.htm", "cuserid", ""); Line("man", "../MAN/dup2.htm", "dup", "duplicate a file descriptor"); Line("man", "../MAN/dup2.htm", "dup2", "duplicate a file descriptor"); Line("whiteball", "execl.html", "execl", ""); Line("whiteball", "execl.html", "execle", ""); Line("whiteball", "execl.html", "execlp", ""); Line("whiteball", "execl.html", "execv", ""); Line("whiteball", "execl.html", "execve", ""); Line("whiteball", "execl.html", "execvp", ""); Line("man", "../MAN/chdir.htm", "fchdir", "Change the current working directory.I am not 100% sure this is supposed to be in unistd."); Line("whiteball", "fork.html", "fork", "Create a child process."); Line("man", "../MAN/pathconf.htm", "fpathconf", "Change the current working directory.I am not 100% sure this is supposed to be in unistd."); Line("whiteball", "setuid.html", "getegid", "Get the group ID of the process."); Line("whiteball", "setuid.html", "geteuid", "Get the User ID of the process."); Line("man", "../MAN/gethostname.htm", "gethostname", "Name of the host (see uname). Not 100% sure this is in unistd"); Line("whiteball", "../MAN/getopt.html", "getopt,", "parse the command line Not 100% sure this is in unistd."); Line("man", "../MAN/getgid.htm", "getgid", "Get a group ID."); Line("man", "../MAN/getgroups.htm", "getgroups", ""); Line("man", "../MAN/getlogin.htm", "getlogin", ""); Line("man", "../MAN/getpgrp.htm", "getpgrp", ""); Line("man", "../MAN/getpid.htm", "getpid", "get process ID."); Line("man", "../MAN/getpid.htm", "getppid,", "get parent process ID."); Line("whiteball", "setuid.html", "getuid", "Get the User ID of the process."); Line("man", "../MAN/isatty.htm", "isatty", ""); Line("man", "../MAN/link.htm", "link", ""); Line("man", "../MAN/lseek.htm", "lseek", ""); Line("man", "../MAN/mkdir.htm", "mkdir", "Make a directory"); Line("whiteball", "open.html", "open", "Open a file"); Line("man", "../MAN/fpathconf.htm", "pathconf", ""); Line("man", "../MAN/pause.htm", "pause", "Put the program to sleep."); Line("whiteball", "pipe.html", "pipe", ""); Line("whiteball", "read.html", "read", "Read a file descriptor."); Line("man", "../MAN/rename.htm", "rename", "Rename a file. This function can also be found in the ANSI stdio library. MAN PAGE."); Line("man", "../MAN/rmdir.htm", "rmdir", "Remove a directory"); Line("whiteball", "setuid.html", "setgid", "Set the Group ID of the process."); Line("man", "../MAN/setpgid.htm", "setpgid", ""); Line("man", "../MAN/setsid.htm", "setsid", ""); W(""); Line("whiteball", "setuid.html", "setuid", "Set the User ID of the process."); W(""); Line("whiteball", "../MAN/sleep.htm", "sleep", "Pause for a required number of seconds."); Line("man", "../MAN/sysconf.htm", "sysconf", ""); Line("man", "../MAN/tcgetpgrp.htm", "tcgetpgrp", ""); Line("man", "../MAN/tcgetpgrp.htm", "tcsetpgrp", ""); Line("man", "../MAN/ttyname.htm", "ttyname", ""); Line("man", "../MAN/unlink.htm", "unlink", "Remove a file"); Line("whiteball", "write.html", "write", "Write to a file descriptor."); access alarm chdir Change the current working directory. chown Change the ownership of a file. close Close a file (see low level functions) chroot Change the root directory I am not 100% sure this is supposed to be in unistd. ctermid cuserid dup duplicate a file descriptor dup2 duplicate a file descriptor execl execle execlp execv execve execvp fchdir Change the current working directory.I am not 100% sure this is supposed to be in unistd. fork Create a child process. fpathconf Change the current working directory.I am not 100% sure this is supposed to be in unistd. getegid Get the group ID of the process. geteuid Get the User ID of the process. gethostname Name of the host (see uname). Not 100% sure this is in unistd getopt, parse the command line Not 100% sure this is in unistd. getgid Get a group ID. getgroups getlogin getpgrp getpid get process ID. getppid, get parent process ID. getuid Get the User ID of the process. isatty link lseek mkdir Make a directory open Open a file pathconf pause Put the program to sleep. pipe read Read a file descriptor. rename Rename a file. This function can also be found in the ANSI stdio library. MAN PAGE. rmdir Remove a directory setgid Set the Group ID of the process. setpgid setsid setuid Set the User ID of the process. sleep Pause for a required number of seconds. sysconf tcgetpgrp tcsetpgrp ttyname unlink Remove a file write Write to a file descriptor. utime.h conio.hDos Specific functions in conio.h Not very portable as conio.h is NOT in the ANSI standard library and does not appear on the Sun or Linux machines.

Line("whiteball", "clrscr.html", "clrscr", "Clear screen"); Line("whiteball", "", "getch", "Get a character from the keyboard."); Line("whiteball", "", "getche", "Get a character from the keyboard.");

clrscr Clear screen getch Get a character from the keyboard. getche Get a character from the keyboard. Non ANSI Standard Unix Functions.These functions are not in the ANSI standard libraries but are handy all the same.

Line("whiteball", "#dirent", "dirent.h", "Functions performing actions on directories"); Line("computer", "../EXAMPLES/statfs.c", "statfs", "Filesystem statistics."); Line("whiteball", "#unistd", "unistd.h", ""); Line("whiteball", "#hotchpotch", "Ungrouped functions.", ""); dirent.h Functions performing actions on directories statfs Filesystem statistics. unistd.h Ungrouped functions. Ungrouped functions

本文地址:http://com.8s8s.com/it/it28115.htm