Outline for May 17, 2002
Handouts: none
Reading: Johnsonbaugh and Kalin, pp. 390-435, 679-702 (appendix of useful functions)
-
Greetings and felicitations!
-
Other Types
-
bit fields
-
unions
-
enumerated types
-
Libraries
-
compiling with libraries
-
common libraries: stdio, ctype
-
Standard I/O Library (#include <stdio.h>)
-
open file: fopen
-
unstructured read/write: getchar, fgetc (getc), putchar, fputc (putc)
-
formatted read/write: fgets (gets), fscanf, fputs (puts), fprintf
-
structured read/write: fread, fwrite
-
random access: fseek, ftell, rewind
-
close file: fclose
-
miscellaneous: feof, ferror, clearerr
-
Character types and conversions (#include <ctype.h>)
-
alphabetics, numerics, alphanumerics: isalnum, ialdigit, isxdigit, isalpha
-
ypper, lower, and conversions: isupper, islower, toupper, tolower
-
types of chars: iscntrl, isgraph (not blank, printable), isprint (printable), ispunct, isspace
-
String conversion (#include <stdlib.h>)
-
string to number: atoi, atof, atol
-
String functions (#include <string.h>)
-
compare: strcmp, strncmp, strcasecmp, strncasecmp; memcmp
-
copy: strcpy, strncpy; memcpy (no overlap), memmove (overlap okay)
-
find character: strchr (index), strrchr (rindex), strpbrk; memchr
-
length: strlen
-
Memory management (#include <stdlib.h>
-
Allocation: malloc, calloc
-
Release: free, cfree (deprecated)
-
Reallocation: realloc()
-
Miscellaneous
-
terminate program (exit); include <stdlib.h>
-
sort array of data (qsort); include <stdlib.h>
-
time of day (time, ctime); include <time.h>
-
execute cvommand (system); include <stdlib.h>