please dont rip this site


C Functions


This is a summary of the useful functions I have come across. I have grouped the functions by library. If you want an alphabetical list, please use the master index. Please refer to a manual for a complete list of ANSI functions.


ANSI standard libraries.

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

assert.h

o   assert  


ctype.h

o   isalnum  Checks whether a character is alphanumeric (A-Z, a-z, 0-9)
o   isalpha  
o   iscntrl  Checks whether a character is a control character or delete ( decimal 0-31 and 127)
o   isdigit  Checks whether a character is a digit (0-9)
o   isgraph  Checks whether a character is a printable character, excluding the space (decimal 32)
o   islower  Checks whether a character is a lower case letter (a-z).
o   isprint  Checks whether a character is printable (decimal 32-126).
o   ispunct  Checks whether a character is punctuation (decimal 32-47, 58-63, 91-96, 123-126)
o   isspace  Checks whether a character is white space - space, CR HT VT NL, FF.
o   isupper  Checks whether a character is an upper case letter (A-Z).
o   isxdigit  Checks whether a character is hex digit (0-9, A-F, a-f).
o   toupper  Converts a lowercase character to uppercase.
o   tolower  Convert an uppercase character to lowercase.


errno.h

o   errno  


float.h

No functions are declared in stddef.h.


limits.h

No functions are declared in stddef.h.


locale.h

o   setlocale


math.h

o   acos
o   asin
o   atan
o   atan2
o   ceil smallest integral value not less than x
o   cos Cosine.
o   cosh
o   exp
o   fabs absolute value of floating-point number
o   floor largest integral value not greater than x
o   fmod floating-point remainder function
o   frexp
o   ldexp
o   log
o   log10
o   modf
o   pow Raise a number by a power.
o   sin The sine of an integer.
o   sinh
o   sqrt Square root of a number.
o   tan Tangent.
o   tanh Hyperbolic tangent.


setjmp.h

o   setjmp
o   longjmp


signal.h

o   signal
o   raise


stdarg.h

o   va_start
o   va_arg
o   va_end
o   An example of use   See also vprintf vfprintf and vsprintf which all print the contents of a va_list


stddef.h

No functions are declared in stddef.h.


stdio.h

This 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.
o   clearerr
o   fclose Close a file.
o   feof Check for EOF while reading a file.
o   fflush
o   fgetc Read a character from a file.
o   fgetpos
o   fgets Read a record from a file (safer than fgetc).
o   fopen Open a file
o   fprintf O/P a line of data to a file.
o   fputc Put a charater into a file.
o   fputs Put a string into a file.
o   fread
o   freopen
o   fscanf
o   fseek
o   fsetpos
o   ftell
o   fwrite
o   getc Get a character from an input stream.
o   getchar Get a character from the keyboard (STDIN).
o   gets Get string (from keyboard).
o   perror
o   printf O/P data to the screen or a file.
o   putchar O/P a character to STDOUT.
o   puts O/P data to the screen or a file.
o   remove Remove a file.
o   rewind
o   scanf
o   setbuf
o   setvbuf
o   sprintf O/P data in tha same way as 'printf' but put it into a string.
o   sscanf Extract fields from a string.
o   tmpfile
o   tmpnam
o   ungetc
o   vfprintf O/P a va_list to a file.
o   vprintf O/P a va_list to stdout.
o   vsprintf O/P a va_list to a string.


stdlib.h

o   abort a program.
o   abs compute the absolute value of an integer. Can be defined outside stdlib.h as macro:
#define abs(amt) ((amt)<0?0-(amt):(amt))
o   atexit Execute the named function when the program terminates.
o   atof convert a string to a double
o   atoi Accepts +-0123456789 leading blanks and converts to integer.
o   atol convert a string to a long integer
o   bsearch Binary chop.
o   calloc memory for an array.
o   div compute the quotient and remainder of integer division
o   exit Normally terminate a program.
o   getenv Get an environmental variable.
o   free memory allocated with malloc.
o   labs compute the absolute value of a long integer
o   ldiv compute the quotient and remainder of long integer division.
o   malloc dynamically allocate memory.
o   mblen determine the number of bytes in a character
o   mbstowcs convert a multibyte string to a wide character string.
o   mbtowc convert a multibyte character to a wide character
o   qsort Sort an array.
o   rand Generate a random number.
o   realloc Reallocate memory.
o   strtod Convert a string to a double.
o   strtol String to long integer conversion. Takes data in various number bases.
o   strtoul Convert a string to an unsigned long. This can also perform number base conversion.
o   srand Seed a random number.
o   system Issue a command to the operating system
o   wctomb convert a wide character to a multibyte character.
o   wcstombs convert a wide character string to a multibyte character string.


string.h

o   memchr Copy a character into memory.
o   memcmp Compare memory locations.
o   memcpy Copy memory.
o   memmove Move memory.
o   memset Set memory.
o   strcat Concatinate two strings.
o   strchr Search for a character in a string.
o   strcmp Compare strings.
o   strcoll
o   strcpy Copy strings.
o   strcspn
o   strerror
o   strlen Length of a string.
o   strncat Concatinate two strings.
o   strncmp Compare two strings.
o   strncpy Copy part of a string.
o   strpbrk
o   strrchr Search for a character in a string.
o   strspn
o   strstr Search a string for a substring.
o   strtok The books say this function splits a string into tokens. I think its function is best described as parsing a string.
o   strxfrm


time.h

o   asctime
o   clock
o   ctime
o   difftime
o   gmtime
o   localtime
o   mktime
o   strftime
o   time
o   Example program using some of the time functions.


POSIX functions start here....


cpio.h


dirent.h

o   opendir Open a directory.
o   closedir Close a directory.
o   readdir Read a directory entry.
o   rewinddir Return to the beginning of a directory.
o   scandir Scan a directory for a matching entry.
o   seekdir Move to an offset in a directory.
o   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.h

It 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.
o   access
o   alarm
o   chdir Change the current working directory.
o   chown Change the ownership of a file.
o   close Close a file (see low level functions)
o   chroot Change the root directory I am not 100% sure this is supposed to be in unistd.
o   ctermid
o   cuserid
o   dup duplicate a file descriptor
o   dup2 duplicate a file descriptor
o   execl
o   execle
o   execlp
o   execv
o   execve
o   execvp
o   fchdir Change the current working directory.I am not 100% sure this is supposed to be in unistd.
o   fork Create a child process.
o   fpathconf Change the current working directory.I am not 100% sure this is supposed to be in unistd.
o   getegid Get the group ID of the process.
o   geteuid Get the User ID of the process.
o   gethostname Name of the host (see uname). Not 100% sure this is in unistd
o   getopt, parse the command line Not 100% sure this is in unistd.
o   getgid Get a group ID.
o   getgroups
o   getlogin
o   getpgrp
o   getpid get process ID.
o   getppid, get parent process ID.
o   getuid Get the User ID of the process.
o   isatty
o   link
o   lseek
o   mkdir Make a directory
o   open Open a file
o   pathconf
o   pause Put the program to sleep.
o   pipe
o   read Read a file descriptor.
o   rename Rename a file. This function can also be found in the ANSI stdio library. MAN PAGE.
o   rmdir Remove a directory
o   setgid Set the Group ID of the process.
o   setpgid
o   setsid
o   setuid Set the User ID of the process.
o   sleep Pause for a required number of seconds.
o   sysconf
o   tcgetpgrp
o   tcsetpgrp
o   ttyname
o   unlink Remove a file
o   write Write to a file descriptor.


utime.h



conio.h

Dos 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.
o   clrscr Clear screen
o   getch Get a character from the keyboard.
o   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.

o   dirent.h Functions performing actions on directories
o   statfs Filesystem statistics.
o   unistd.h
o   Ungrouped functions.


Ungrouped functions

o   endpwent
o   fgetpwent
o   getpw Get a password entry.
o   getpwent Get a password entry.
o   getpwnam Get a record by keying on the user name.
o   getpwuid Get a record by keying on the UID (numeric).
o   getuidx Get the User ID of a process (RS/6000 only).
o   index Search for a character in a string (Use strchr to conform to the ANSI standard).
o   putpwent
o   pclose Close a pipe.
o   popen Open a Unix pipe.
o   putenv Change or create an environmental variable.
o   setenv Change or create an environmental variable.
o   setpwent
o   setreuid Set the ID of the process calling process.
o   stat Get status information on files (modification time, file size etc).
o   uname Get information about the machine we are running on.
o   unsetenv Remove an environmental variable.
o   setuidx Set the User ID of the process (RS/6000 only).
o   setegid setrgid Set the Group ID of the process.
o   seteuid setruid Set the User ID of the process.
o   getruid Get the User ID of the process.
o   sizeof Return the storage allocation for a data type.This is actually an operator! I have put it in here as it looks like a function and so you will probably look for it here....
o   example showing the size of data types
o   example showing the size of data objects.



User written functions
(and a few lifted from books)


o   clrscr. Clear the screen using VT escape sequence.
o   convesc. Insert escape codes into a text string.
o   basename. Strip directory information from a Unix file name.
o   printenv. List the environmental variables.
o   lenstr User written version of strlen
o   reverse Reverse characters in a string.


Top Master Index Keywords Functions


Martin Leslie 18-Feb-96

file: /Techref/language/ccpp/cref/functions/index.htm, 45KB, , updated: 2017/8/26 11:08, local time: 2024/12/29 04:20,
TOP NEW HELP FIND: 
18.221.161.43:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/techref/language/ccpp/cref/functions/index.htm"> C Functions</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?