-

Difference between revisions of "Standard Library Functions"

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

Latest revision as of 11:42, 14 December 2017

STANDARD I/O

fopen(name, mode)  
Open file for I/O
freopen(name, mode, stream)  
Re-open existing stream
fdopen(fd, mode)  
Associate a stream with a file descriptor[WikiEditor:This item is not described on original document]
fclose(stream)  
Close open file
fflush(stream)  
Flush buffered data
getc(stream)  
Read byte from stream
fgetc(stream)  
Same as getc
ungetc(c, stream)  
Push char back onto stream
putc(c, stream)  
Write byte to stream
fputc(c, stream)  
Same as putc()
getchar()  
Read byte from standard input
putchar(c)  
Write byte to standard output
getw(stream)  
Read word from stream
putw(w, stream)  
Write word to stream
gets(s)  
Read line from standard input
fgets(s, n, stream)  
Read string from stream
puts(s)  
Write string to standard output
fputs(s, stream)  
Write string to stream
fread(buf, size, cnt, stream)  
Binary read from stream
fwrite(buf, size, cnt, stream)  
Binary write to stream
fseek(stream, offs, wh)  
Random access positioning
ftell(stream)  
Current file read/write position
rewind(stream)  
Reposition file pointer to start
setvbuf(stream, buf, mode, size)  
Enable/disable buffering of stream
fprintf(stream, fmt, args)  
Formatted output on stream
printf(fmt, args)  
Formatted standard output
sprintf(buf, fmt, args)  
Formatted output to a string
vfprintf(stream, fmt, va_ptr)  
Formatted output on stream
vprintf(fmt, va_ptr)  
Formatted standard output
vsprintf(buf, fmt, va_ptr)  
Formatted output to a string
fscanf(stream, fmt, args)  
Formatted input from stream
scanf(fmt, args)  
Formatted standard input
sscanf(buf, fmt, va_ptr)  
Formatted input from a string
vfscanf(stream, fmt, va_ptr)  
Formatted input from stream
vscanf(fmt, args)  
Formatted standard input
[[Functions_HI-TECH_C_VSSCANF|vsscanf(buf, fmt, va_ptr)]  
Formatted input from a string
feof(stream)  
True if stream at EOF
ferror(stream)  
True if error on stream
clrerr(stream)  
Reset error status on stream
fileno(stream)  
Return fd from stream
remove(name)  
Remove (delete) file

STRING HANDLING

atoi(s)  
Convert ASCII decimal to integer
atol(s)  
Convert ASCII decimal to long integer
atof(s)  
Convert ASCII decimal to float
xtoi(s)  
Convert ASCII hexadecimal to integer[WikiEditor:This item is not described on original document]
memchr(s, c, n)  
Find char in memory block
memcmp(s1, s2, n)  
Compare n bytes of memory
memcpy(s1, s2, n)  
Copy n bytes from s2 to s1
memmove(s1, s2, n)  
Copy n bytes from s2 to s1
memset(s, c, n)  
Set n bytes at s to c
strcat(s1, s2)  
Append string 2 to string 1
strncat(s1, s2, n)  
Append at most n chars to string 1
strcmp(s1, s2)  
Compare strings
strncmp(s1, s2, n)  
Compare n bytes of strings
strcpy(s1, s2)  
Copy s2 to s1
strncpy(s1, s2, n)  
Copy at most n bytes of s2
strerror(errnum)  
Map errnum to an error message string[WikiEditor:This item is not described on original document]
strlen(s)  
Length of string
strchr(s, c)  
Find char in string
strrchr(s, c)  
Find rightmost char in string
strspn(s1, s2)  
Length of s1 composed of chars from s2[WikiEditor:This item is not described on original document]
strcspn(s1, s2)  
Length of s2 composed of chars not from s2[WikiEditor:This item is not described on original document]
strstr(s1, s2)  
Locate the first occurence of s2 in s1[WikiEditor:This item is not described on original document]

LOW LEVEL I/O

open(name, mode)  
Open a file
close(fd)  
Close a file
creat(name)  
Create a file
dup(fd)  
Duplicate file descriptor
lseek(fd, offs, wh)  
Random access positioning
read(fd, buf, cnt)  
Read from file
rename(name1, name2)  
Rename file
unlink(name)  
Remove file from directory
write(fd, buf, cnt)  
Write to file
isatty(fd)  
True if fd refers to tty-like device
stat(name, buf)  
Get information about a file
chmod(name, mode)  
Set file attributes

CHARACTER TESTING

isalpha(c)  
True if c is a letter
isupper(c)  
Upper case letter
islower(c)  
Lower case letter
isdigit(c)  
Digit
isalnum(c)  
Alphnumeric character
isspace(c)  
Space, tab, newline, return or formfeed
ispunct(c)  
Punctuation character
isprint(c)  
Printable character
isgraph(c)  
Printable non-space character
iscntrl(c)  
Control character
isascii(c)  
Ascii character (0-127)

FLOATING POINT

cos(f)  
Cosine function
sin(f)  
Sine function
tan(f)  
Tangent function
acos(f)  
Arc cosine function
asin(f)  
Arc sine function
atan(f)  
Arc tangent function
exp(f)  
Exponential of f
log(f)  
Natural log of f
log10(f)  
Base 10 log of f
pow(x,y)  
X to the y'th power
sqrt(f)  
Square root
fabs(f)  
Floating absolute value
ceil(f)  
Smallest integral value >= f
floor(f)  
Largest integral value <= f
sinh(f)  
Hyperbolic sine
cosh(f)  
Hyperbolic cosine
tanh(f)  
Hyperbolic tangent
frexp(y, p)  
Split into mantissa and exponent
ldexp(y, i)  
Load new exponent

CONSOLE I/O

getch()  
Get single character
getche()  
Get single character with echo
putch(c)  
Put single character
ungetch(c)  
Push character back
kbhit()  
Test for key pressed
cgets(s)  
Get line from console
cputs(s)  
Put string to console

DATE AND TIME FUNCTIONS

time(p)  
Get current date/time
gmtime(p)  
Get broken down Universal time
localtime(p)  
Get broken down local time
asctime(t)  
Convert broken down time to ascii
ctime(p)  
Convert time to ascii

MISCELLANEOUS

execl(name, args)  
Execute another program
execv(name, argp)  
Execute another program
spawnl(name, arg, ...)  
Execute a subprogram
spawnv(name, argp)  
Execute a subprogram
system(s)  
Execute system command
atexit(func)  
Install func to be executed on termination
exit(status)  
Terminate execution
[[Functions_HI-TECH_C__EXIT|_exit(status)]]  
Terminate execution immediately
getuid()  
Get user id (CP/M)
setuid(uid)  
Set user id (CP/M)
chdir(s)  
Change directory (MS-DOS)
mkdir(s)  
Create directory (MS-DOS)
rmdir(s)  
Remove directory (MS-DOS)
getcwd(drive)  
Get current working directory (MS-DOS)
signal(sig, func)  
Set trap for interrupt condition
brk(addr)  
Set memory allocation
sbrk(incr)  
Adjust memory allocation
malloc(cnt)  
Dynamic memory allocation
free(ptr)  
Dynamic memory release
realloc(ptr, cnt)  
Dynamic memory reallocation
calloc(cnt, size)  
Dynamic memory allocation zeroed
perror(s)  
Print error message
qsort(base, nel, width, func)  
Quick sort
srand(seed)  
Initialize random number generator
rand()  
Get next random number
setjmp(buf)  
Setup for non-local goto
longjmp(buf, val)  
Non-local goto
[[Functions_HI-TECH_C__GETARGS|_getargs(buf, name)]]  
Wild card expansion and i/o redirection
inp(port)  
Read port
outp(port, data)  
Write data to port
bdos(func, val)  
Perform bdos call (CP/M)
msdos(func, val, val, ...)  
Perform msdos call
msdoscx(func, val, val, ...)  
Alternate msdos call
intdos(ip, op)  
Execute DOS interrupt
intdosx(ip, op, sp)  
Execute DOS interrupt
segread(sp)  
Get segment register values
int86(int, ip, op)  
Execute software interrupt
int86x(int, ip, op, sp)  
Execute software interrupt
bios(n, c)  
Call bios entry (CP/M)
ei()  
Enable interrupts
di()  
Disable interrupts
set_vector(vec, func)  
Set an interrupt vector
assert(e)  
Run time assertion
getenv(s)  
Get environment string (MS-DOS)