-

Changes

Jump to: navigation, search

Standard Library Functions

4,942 bytes added, 01:15, 1 August 2017
m
no edit summary
 
== STANDARD I/O ==
;[[Functions_HI-TECH_C_FOPEN|fopen(name, mode) ]] :Open file for I/O;[[Functions_HI-TECH_C_FREOPEN|freopen(name, mode, stream) ]] :Re-open existing stream;[[Functions_HI-TECH_C_FDOPEN|fdopen(fd, mode) ]] :Associate a stream with a file descriptor;[[Functions_HI-TECH_C_FCLOSE|fclose(stream) ]] :Close open file;[[Functions_HI-TECH_C_FFLUSH|fflush(stream) ]] :Flush buffered data;[[Functions_HI-TECH_C_GETC|getc(stream) ]] :Read byte from stream;[[Functions_HI-TECH_C_FGETC|fgetc(stream) ]] :Same as getc;[[Functions_HI-TECH_C_UNGETC|ungetc(c, stream) ]] :Push char back onto stream;[[Functions_HI-TECH_C_PUTC|putc(c, stream) ]] :Write byte to stream;[[Functions_HI-TECH_C_FPUTC|fputc(c, stream) ]] :Same as putc();[[Functions_HI-TECH_C_GETCHAR|getchar() ]] :Read byte from standard input;[[Functions_HI-TECH_C_PUTCHAR|putchar(c) ]] :Write byte to standard output;[[Functions_HI-TECH_C_GETW|getw(stream) ]] :Read word from stream;[[Functions_HI-TECH_C_PUTW|putw(w, stream) ]] :Write word to stream;[[Functions_HI-TECH_C_GETS|gets(s) ]] :Read line from standard input;[[Functions_HI-TECH_C_FGETS|fgets(s, n, stream) ]] :Read string from stream;[[Functions_HI-TECH_C_PUTS|puts(s) ]] :Write string to standard output;[[Functions_HI-TECH_C_FPUTS|fputs(s, stream) ]] :Write string to stream;[[Functions_HI-TECH_C_FREAD|fread(buf, size, cnt, stream) ]] :Binary read from stream;[[Functions_HI-TECH_C_FWRITE|fwrite(buf, size, cnt, stream) ]] :Binary write to stream;[[Functions_HI-TECH_C_FSEEK|fseek(stream, offs, wh) ]] :Random access positioning;[[Functions_HI-TECH_C_FTELL|ftell(stream) ]] :Current file read/write position;[[Functions_HI-TECH_C_REWIND|rewind(stream) ]] :Reposition file pointer to start;[[Functions_HI-TECH_C_SETVBUF|setvbuf(stream, buf, mode, size) ]] :Enable/disable buffering of stream;[[Functions_HI-TECH_C_FPRINTF|fprintf(stream, fmt, args) ]] :Formatted output on stream;[[Functions_HI-TECH_C_PRINTF|printf(fmt, args) ]] :Formatted standard output;[[Functions_HI-TECH_C_SPRINTF|sprintf(buf, fmt, args) ]] :Formatted output to a string;[[Functions_HI-TECH_C_VFPRINTF|vfprintf(stream, fmt, va_ptr) ]] :Formatted output on stream;[[Functions_HI-TECH_C_VPRINTF|vprintf(fmt, va_ptr) ]] :Formatted standard output;[[Functions_HI-TECH_C_VSPRINTF|vsprintf(buf, fmt, va_ptr) ]] :Formatted output to a string;[[Functions_HI-TECH_C_FSCANF|fscanf(stream, fmt, args) ]] :Formatted input from stream;[[Functions_HI-TECH_C_SCANF|scanf(fmt, args) ]] :Formatted standard input;[[Functions_HI-TECH_C_SSCANF|sscanf(buf, fmt, va_ptr) ]] :Formatted input from a string;[[Functions_HI-TECH_C_VFSCANF|vfscanf(stream, fmt, va_ptr) ]] :Formatted input from stream;[[Functions_HI-TECH_C_VSCANF|vscanf(fmt, args) ]] :Formatted standard input;[[Functions_HI-TECH_C_VSSCANF|vsscanf(buf, fmt, va_ptr) ] :Formatted input from a string;[[Functions_HI-TECH_C_FEOF|feof(stream) ]] :True if stream at EOF;[[Functions_HI-TECH_C_FERROR|ferror(stream) ]] :True if error on stream;[[Functions_HI-TECH_C_CLRERR|clrerr(stream) ]] :Reset error status on stream;[[Functions_HI-TECH_C_FILENO|fileno(stream) ]] :Return fd from stream;[[Functions_HI-TECH_C_REMOVE|remove(name) ]] :Remove (delete) file
== STRING HANDLING ==
;[[Functions_HI-TECH_C_ATOI|atoi(s) ]] :Convert ASCII decimal to integer;[[Functions_HI-TECH_C_ATOL|atol(s) ]] :Convert ASCII decimal to long integer;[[Functions_HI-TECH_C_ATOF|atof(s) ]] :Convert ASCII decimal to float;[[Functions_HI-TECH_C_XTOI|xtoi(s) ]] :Convert ASCII hexadecimal to integer;[[Functions_HI-TECH_C_MEMCHR|memchr(s, c, n) ]] :Find char in memory block;[[Functions_HI-TECH_C_MEMCMP|memcmp(s1, s2, n) ]] :Compare n bytes of memory;[[Functions_HI-TECH_C_MEMCPY|memcpy(s1, s2, n) ]] :Copy n bytes from s2 to s1;[[Functions_HI-TECH_C_MEMMOVE|memmove(s1, s2, n) ]] :Copy n bytes from s2 to s1;[[Functions_HI-TECH_C_MEMSET|memset(s, c, n) ]] :Set n bytes at s to c;[[Functions_HI-TECH_C_STRCAT|strcat(s1, s2) ]] :Append string 2 to string 1;[[Functions_HI-TECH_C_STRNCAT|strncat(s1, s2, n) ]] :Append at most n chars to string 1;[[Functions_HI-TECH_C_STRCMP|strcmp(s1, s2) ]] :Compare strings;[[Functions_HI-TECH_C_STRNCMP|strncmp(s1, s2, n) ]] :Compare n bytes of strings;[[Functions_HI-TECH_C_STRCPY|strcpy(s1, s2) ]] :Copy s2 to s1;[[Functions_HI-TECH_C_STRNCPY|strncpy(s1, s2, n) ]] :Copy at most n bytes of s2;[[Functions_HI-TECH_C_STRERROR|strerror(errnum) ]] :Map errnum to an error message string;[[Functions_HI-TECH_C_STRLEN|strlen(s) ]] :Length of string;[[Functions_HI-TECH_C_STRCHR|strchr(s, c) ]] :Find char in string;[[Functions_HI-TECH_C_STRRCHR|strrchr(s, c) ]] :Find rightmost char in string;[[Functions_HI-TECH_C_STRSPN|strspn(s1, s2) ]] :Length of s1 composed of chars from s2;[[Functions_HI-TECH_C_STRCSPN|strcspn(s1, s2) ]] :Length of s2 composed of chars not from s2;[[Functions_HI-TECH_C_STRSTR|strstr(s1, s2) ]] :Locate the first occurence of s2 in s1
== LOW LEVEL I/O ==
;[[Functions_HI-TECH_C_OPEN|open(name, mode) ]] :Open a file;[[Functions_HI-TECH_C_CLOSE|close(fd) ]] :Close a file;[[Functions_HI-TECH_C_CREAT|creat(name) ]] :Create a file;[[Functions_HI-TECH_C_DUP|dup(fd) ]] :Duplicate file descriptor;[[Functions_HI-TECH_C_LSEEK|lseek(fd, offs, wh) ]] :Random access positioning;[[Functions_HI-TECH_C_READ|read(fd, buf, cnt) ]] :Read from file;[[Functions_HI-TECH_C_RENAME|rename(name1, name2) ]] :Rename file;[[Functions_HI-TECH_C_UNLINK|unlink(name) ]] :Remove file from directory;[[Functions_HI-TECH_C_WRITE|write(fd, buf, cnt) ]] :Write to file;[[Functions_HI-TECH_C_ISATTY|isatty(fd) ]] :True if fd refers to tty-like device;[[Functions_HI-TECH_C_STAT|stat(name, buf) ]] :Get information about a file;[[Functions_HI-TECH_C_CHMOD|chmod(name, mode) ]] :Set file attributes
== CHARACTER TESTING ==
;[[Functions_HI-TECH_C_ISALPHA|isalpha(c) ]] :True if c is a letter;[[Functions_HI-TECH_C_ISUPPER|isupper(c) ]] :Upper case letter;[[Functions_HI-TECH_C_ISLOWER|islower(c) ]] :Lower case letter;[[Functions_HI-TECH_C_ISDIGIT|isdigit(c) ]] :Digit;[[Functions_HI-TECH_C_ISALNUM|isalnum(c) ]] :Alphnumeric character;[[Functions_HI-TECH_C_ISSPACE|isspace(c) ]] :Space, tab, newline, return or formfeed;[[Functions_HI-TECH_C_ISPUNCT|ispunct(c) ]] :Punctuation character;[[Functions_HI-TECH_C_ISPRINT|isprint(c) ]] :Printable character;[[Functions_HI-TECH_C_ISGRAPH|isgraph(c) ]] :Printable non-space character;[[Functions_HI-TECH_C_ISCNTRL|iscntrl(c) ]] :Control character;[[Functions_HI-TECH_C_ISASCII|isascii(c) ]] :Ascii character (0-127)
== FLOATING POINT ==
;[[Functions_HI-TECH_C_COS|cos(f) ]] :Cosine function;[[Functions_HI-TECH_C_SIN|sin(f) ]] :Sine function;[[Functions_HI-TECH_C_TAN|tan(f) ]] :Tangent function;[[Functions_HI-TECH_C_ACOS|acos(f) ]] :Arc cosine function;[[Functions_HI-TECH_C_ASIN|asin(f) ]] :Arc sine function;[[Functions_HI-TECH_C_ATAN|atan(f) ]] :Arc tangent function;[[Functions_HI-TECH_C_EXP|exp(f) ]] :Exponential of f;[[Functions_HI-TECH_C_LOG|log(f) ]] :Natural log of f;[[Functions_HI-TECH_C_LOG10|log10(f) ]] :Base 10 log of f;[[Functions_HI-TECH_C_POW|pow(x,y) ]] :X to the y'th power;[[Functions_HI-TECH_C_SQRT|sqrt(f) ]] :Square root;[[Functions_HI-TECH_C_FABS|fabs(f) ]] :Floating absolute value;[[Functions_HI-TECH_C_CEIL|ceil(f) ]] :Smallest integral value >= f;[[Functions_HI-TECH_C_FLOOR|floor(f) ]] :Largest integral value <= f;[[Functions_HI-TECH_C_SINH|sinh(f) ]] :Hyperbolic sine;[[Functions_HI-TECH_C_COSH|cosh(f) ]] :Hyperbolic cosine;[[Functions_HI-TECH_C_TANH|tanh(f) ]] :Hyperbolic tangent;[[Functions_HI-TECH_C_FREXP|frexp(y, p) ]] :Split into mantissa and exponent;[[Functions_HI-TECH_C_LDEXP|ldexp(y, i) ]] :Load new exponent
== CONSOLE I/O ==
;[[Functions_HI-TECH_C_GETCH|getch() ]] :Get single character;[[Functions_HI-TECH_C_GETCHE|getche() ]] :Get single character with echo;[[Functions_HI-TECH_C_PUTCH|putch(c) ]] :Put single character;[[Functions_HI-TECH_C_UNGETCH|ungetch(c) ]] :Push character back;[[Functions_HI-TECH_C_KBHIT|kbhit() ]] :Test for key pressed;[[Functions_HI-TECH_C_CGETS|cgets(s) ]] :Get line from console;[[Functions_HI-TECH_C_CPUTS|cputs(s) ]] :Put string to console
== DATE AND TIME FUNCTIONS ==
;[[Functions_HI-TECH_C_TIME|time(p) ]] :Get current date/time;[[Functions_HI-TECH_C_GMTIME|gmtime(p) ]] :Get broken down Universal time;[[Functions_HI-TECH_C_LOCALTIME|localtime(p) ]] :Get broken down local time;[[Functions_HI-TECH_C_ASCTIME|asctime(t) ]] :Convert broken down time to ascii;[[Functions_HI-TECH_C_CTIME|ctime(p) ]] :Convert time to ascii
== MISCELLANEOUS ==
;[[Functions_HI-TECH_C_EXECL|execl(name, args) ]] :Execute another program;[[Functions_HI-TECH_C_EXECV|execv(name, argp) ]] :Execute another program;[[Functions_HI-TECH_C_SPAWNL|spawnl(name, arg, ...) ]] :Execute a subprogram;[[Functions_HI-TECH_C_SPAWNV|spawnv(name, argp) ]] :Execute a subprogram;[[Functions_HI-TECH_C_SYSTEM|system(s) ]] :Execute system command;[[Functions_HI-TECH_C_ATEXIT|atexit(func) ]] :Install func to be executed on termination;[[Functions_HI-TECH_C_EXIT|exit(status) ]] :Terminate execution;<nowiki>[[Functions_HI-TECH_C__EXIT|_exit(status) ]]</nowiki> :Terminate execution immediately;[[Functions_HI-TECH_C_GETUID|getuid() ]] :Get user id (CP/M);[[Functions_HI-TECH_C_SETUID|setuid(uid) ]] :Set user id (CP/M);[[Functions_HI-TECH_C_CHDIR|chdir(s) ]] :Change directory (MS-DOS);[[Functions_HI-TECH_C_MKDIR|mkdir(s) ]] :Create directory (MS-DOS);[[Functions_HI-TECH_C_RMDIR|rmdir(s) ]] :Remove directory (MS-DOS);[[Functions_HI-TECH_C_GETCWD|getcwd(drive) ]] :Get current working directory (MS-DOS);[[Functions_HI-TECH_C_SIGNAL|signal(sig, func) ]] :Set trap for interrupt condition;[[Functions_HI-TECH_C_BRK|brk(addr) ]] :Set memory allocation;[[Functions_HI-TECH_C_SBRK|sbrk(incr) ]] :Adjust memory allocation;[[Functions_HI-TECH_C_MALLOC|malloc(cnt) ]] :Dynamic memory allocation;[[Functions_HI-TECH_C_FREE|free(ptr) ]] :Dynamic memory release;[[Functions_HI-TECH_C_REALLOC|realloc(ptr, cnt) ]] :Dynamic memory reallocation;[[Functions_HI-TECH_C_CALLOC|calloc(cnt, size) ]] :Dynamic memory allocation zeroed;[[Functions_HI-TECH_C_PERROR|perror(s) ]] :Print error message;[[Functions_HI-TECH_C_QSORT|qsort(base, nel, width, func) ]] :Quick sort;[[Functions_HI-TECH_C_SRAND|srand(seed) ]] :Initialize random number generator;[[Functions_HI-TECH_C_RAND|rand() ]] :Get next random number;[[Functions_HI-TECH_C_SETJMP|setjmp(buf) ]] :Setup for non-local goto;[[Functions_HI-TECH_C_LONGJMP|longjmp(buf, val) ]] :Non-local goto;<nowiki>[[Functions_HI-TECH_C__GETARGS|_getargs(buf, name) ]]</nowiki> :Wild card expansion and i/o redirection;[[Functions_HI-TECH_C_INP|inp(port) ]] :Read port;[[Functions_HI-TECH_C_OUTP|outp(port, data) ]] :Write data to port;[[Functions_HI-TECH_C_BDOS|bdos(func, val) ]] :Perform bdos call (CP/M);[[Functions_HI-TECH_C_MSDOS|msdos(func, val, val, ...) ]] :Perform msdos call;[[Functions_HI-TECH_C_MSDOSCX|msdoscx(func, val, val, ...) ]] :Alternate msdos call;[[Functions_HI-TECH_C_INTDOS|intdos(ip, op) ]] :Execute DOS interrupt;[[Functions_HI-TECH_C_INTDOSX|intdosx(ip, op, sp) ]] :Execute DOS interrupt;[[Functions_HI-TECH_C_SEGREAD|segread(sp) ]] :Get segment register values;[[Functions_HI-TECH_C_INT86|int86(int, ip, op) ]] :Execute software interrupt;[[Functions_HI-TECH_C_INT86X|int86x(int, ip, op, sp) ]] :Execute software interrupt;[[Functions_HI-TECH_C_BIOS|bios(n, c) ]] :Call bios entry (CP/M);[[Functions_HI-TECH_C_EI|ei() ]] :Enable interrupts;[[Functions_HI-TECH_C_DI|di() ]] :Disable interrupts;[[Functions_HI-TECH_C_SET_VECTOR|set_vector(vec, func) ]] :Set an interrupt vector;[[Functions_HI-TECH_C_ASSERT|assert(e) ]] :Run time assertion;[[Functions_HI-TECH_C_GETENV|getenv(s) ]] :Get environment string (MS-DOS)

Navigation menu