home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c500 / 4.ddi / WATCOMC.WPK / WATCOMC.HLP
Encoding:
Text File  |  1992-05-28  |  238.7 KB  |  6,420 lines

  1. ::::_BEGINTHREAD
  2. #include \<process.h>
  3. int __far _beginthread(
  4.          void (__far *start_address)(void __far *),
  5.          void __far *stack_bottom,
  6.          unsigned stack_size,
  7.          void __far *arglist );
  8.  
  9. The _beginthread  function uses the OS/2 function  DosCreateThread  to
  10. begin  a  new  thread  of  execution  at the  function    identified  by
  11. "start_address"  with a single    parameter identified by "arglist". The
  12. new  thread  will  use the memory  identified  by  "stack_bottom"  and
  13. "stack_size"  for its stack.   The thread  ends when it exits from its
  14. main function or calls exit, _exit or _endthread.
  15. ::::_BIOS_DISK
  16. #include \<bios.h>
  17. unsigned short _bios_disk( unsigned service,
  18.                struct diskinfo_t *diskinfo );
  19. struct    diskinfo_t {        /* disk parameters     */
  20.     unsigned drive;     /* drive number     */
  21.     unsigned head;        /* head number     */
  22.     unsigned track;     /* track number     */
  23.     unsigned sector;    /* sector number     */
  24.     unsigned nsectors;  /* number of sectors */
  25.     void __far *buffer; /* buffer address     */
  26. };
  27.  
  28. The  _bios_disk  function  uses INT 0x13 to provide access to the BIOS
  29. disk functions.    Information for the desired "service" is passed the
  30. diskinfo_t structure pointed to by "diskinfo". The value for "service"
  31. can be one of the following values:
  32.  
  33. _DISK_RESET    Forces  the disk  controller to do a reset on the disk.
  34.            This request does not use the "diskinfo" argument.
  35.  
  36. _DISK_STATUS   Obtains the status of the last disk operation.
  37.  
  38. _DISK_READ     Reads the  specified  number of sectors    from the disk.
  39.            This  request uses all of the information passed in the
  40.            "diskinfo" structure.
  41.  
  42. _DISK_WRITE    Writes the specified amount of data to the disk.   This
  43.            request    uses  all  of the  information    passed    in the
  44.            "diskinfo" structure.
  45.  
  46. _DISK_VERIFY   Checks the disk to be sure the  specified sectors exist
  47.            and can be read.   A CRC (cyclic redundancy check) test
  48.            is performed.  This request uses all of the information
  49.            passed  in the  "diskinfo"  structure  except  for  the
  50.            "buffer" field.
  51.  
  52. _DISK_FORMAT   Formats    the  specified track on the disk.   The "head"
  53.            and  "track" fields indicate the track to be formatted.
  54.            Only one track can be formatted per call.  The "buffer"
  55.            field  points to a set of sector  markers, whose format
  56.            depends on the type of disk drive.  This service has no
  57.            return value.
  58. ::::_BIOS_EQUIPLIST
  59. #include \<bios.h>
  60. unsigned short _bios_equiplist( void );
  61.  
  62. The  _bios_equiplist function uses INT 0x11 to determine what hardware
  63. and peripherals are installed on the machine.
  64. ::::_BIOS_KEYBRD
  65. #include \<bios.h>
  66. unsigned short _bios_keybrd( unsigned service );
  67.  
  68. The  _bios_keybrd  function  uses INT 0x16 to access the BIOS keyboard
  69. services.    The  possible  values  for  "service"  are the  following
  70. constants:
  71.  
  72. _KEYBRD_READ         Reads the next character from the keyboard.   The
  73.              function  will  wait until a  character  has been
  74.              typed.
  75.  
  76. _KEYBRD_READY         Checks to see if a character has been typed.   If
  77.              there is one,  then its  value  will be returned,
  78.              but it is not removed from the input buffer.
  79.  
  80. _KEYBRD_SHIFTSTATUS  Returns the current state of special keys.
  81. ::::_BIOS_MEMSIZE
  82. #include \<bios.h>
  83. unsigned short _bios_memsize( void );
  84.  
  85. The _bios_memsize function uses INT 0x12 to determine the total amount
  86. of memory available.
  87. ::::_BIOS_PRINTER
  88. #include \<bios.h>
  89. unsigned short _bios_printer( unsigned service,
  90.                   unsigned port,
  91.                   unsigned data );
  92.  
  93. The  _bios_printer  function  uses INT 0x17 to perform    printer output
  94. services  to the  printer  specified by "port". The values for service
  95. are:
  96.  
  97. _PRINTER_WRITE      Sends the  low-order    byte of "data" to the  printer
  98.           specified by "port".
  99.  
  100. _PRINTER_INIT      Initializes the printer specified by "port".
  101.  
  102. _PRINTER_STATUS   Get the status of the printer specified by "port".
  103. ::::_BIOS_SERIALCOM
  104. #include \<bios.h>
  105. unsigned short _bios_serialcom( unsigned service,
  106.                 unsigned serial_port,
  107.                 unsigned data );
  108.  
  109. The   _bios_serialcom    function  uses    INT  0x14  to  provide    serial
  110. communications services to the serial port specified by "serial_port".
  111. 0  represents  COM1, 1 represents  COM2, etc.    The values for service
  112. are:
  113.  
  114. _COM_INIT      Initializes the serial port to the parameters specified
  115.            in "data".
  116.  
  117. _COM_SEND      Transmits  the  low-order  byte of "data" to the serial
  118.            port.
  119.  
  120. _COM_RECEIVE   Reads an input character from the serial port.
  121.  
  122. _COM_STATUS    Returns the current status of the serial port.
  123.  
  124. The  value  passed in "data" for the  _COM_INIT  service  can be built
  125. using the appropriate combination of the following values:
  126.  
  127. _COM_110      110 baud
  128. _COM_150      150 baud
  129. _COM_300      300 baud
  130. _COM_600      600 baud
  131. _COM_1200      1200 baud
  132. _COM_2400      2400 baud
  133. _COM_4800      4800 baud
  134. _COM_9600      9600 baud
  135.  
  136. _COM_NOPARITY      No parity
  137. _COM_EVENPARITY   Even parity
  138. _COM_ODDPARITY      Odd parity
  139.  
  140. _COM_CHR7      7 data bits
  141. _COM_CHR8      8 data bits
  142.  
  143. _COM_STOP1      1 stop bit
  144. _COM_STOP2      2 stop bits
  145. ::::_BIOS_TIMEOFDAY
  146. #include \<bios.h>
  147. unsigned _bios_timeofday( int service, long *timeval );
  148.  
  149. The  _bios_timeofday  function uses INT 0x1A to get or set the current
  150. system clock value.  The values for service are:
  151.  
  152. _TIME_GETCLOCK      Places  the    current  system  clock    value  in  the
  153.           location  pointed  to  by  "timeval".  The  function
  154.           returns  zero if  midnight  has not passed since the
  155.           last     time  the  system  clock  was    read  or  set;
  156.           otherwise, it returns 1.
  157.  
  158. _TIME_SETCLOCK      Sets the  system  clock to the value in the location
  159.           pointed to by "timeval".
  160. ::::_CHAIN_INTR
  161. #include \<dos.h>
  162. void _chain_intr( void (__interrupt __far *func)() );
  163.  
  164. The _chain_intr function is used at the end of an interrupt routine to
  165. start  executing  another  interrupt  handler  (usually  the  previous
  166. handler for that interrupt).  When the interrupt handler designated by
  167. "func"    receives control, the stack and registers appear as though the
  168. interrupt just occurred.
  169. ::::_CLEAR87
  170. #include \<float.h>
  171. unsigned int _clear87( void );
  172.  
  173. The _clear87  function    clears the floating-point status word which is
  174. used to  record  the status of    8087/80287/80387/80486    floating-point
  175. operations.
  176. ::::_CONTROL87
  177. #include \<float.h>
  178. unsigned int _control87( unsigned int newcw,
  179.              unsigned int mask );
  180.  
  181. The   _control87   function   updates    the   control    word   of  the
  182. 8087/80287/80387/80486.    If "mask" is zero, then the control word is
  183. not updated.   If "mask" is non-zero, then the control word is updated
  184. with  bits  from  "newcw"  corresponding  to  every  bit that is on in
  185. "mask".
  186. ::::_DISABLE
  187. #include \<dos.h>
  188. void _disable( void );
  189.  
  190. The _disable function causes interrupts to become disabled.
  191.  
  192. The _disable  function    would be used in  conjunction with the _enable
  193. function  to make sure that a sequence    of  instructions  are executed
  194. without any intervening interrupts occurring.
  195. ::::_DOS_ALLOCMEM
  196. #include \<dos.h>
  197. unsigned _dos_allocmem( unsigned size,
  198.             unsigned short *segment);
  199.  
  200. The  _dos_allocmem  function  uses system call 0x48 to allocate "size"
  201. paragraphs  directly  from DOS.   The size of a paragraph is 16 bytes.
  202. The  allocated    memory    is  always  paragraph  aligned.    The segment
  203. descriptor for the allocated memory is returned in the word pointed to
  204. by  "segment".    If the allocation request fails, the maximum number of
  205. paragraphs that can be allocated is returned in this word instead.
  206. ::::_DOS_CLOSE
  207. #include \<dos.h>
  208. unsigned _dos_close( int handle );
  209.  
  210. The  _dos_close  function  uses  system  call  0x3E  to close the file
  211. indicated by "handle". The value for "handle" is the one returned by a
  212. function call that created or last opened the file.
  213. ::::_DOS_CREAT
  214. #include \<dos.h>
  215. unsigned _dos_creat( char *path,
  216.              unsigned attribute,
  217.              int *handle );
  218.  
  219. The  _dos_creat  function  uses  system call 0x3C to create a new file
  220. named "path," with the access attributes specified by "attribute". The
  221. handle    for  the  new  file  is  returned  in the word    pointed  to by
  222. "handle". If the file already exists, the contents will be erased, and
  223. the attributes of the file will remain unchanged.
  224. ::::_DOS_CREATNEW
  225. #include \<dos.h>
  226. unsigned _dos_creatnew( char *path,
  227.             unsigned attribute,
  228.             int *handle );
  229.  
  230. The  _dos_creatnew function uses system call 0x5B to create a new file
  231. named "path," with the access attributes specified by "attribute". The
  232. handle    for  the  new  file  is  returned  in the word    pointed  to by
  233. "handle". If the file already exists, the create will fail.
  234. ::::_DOS_FINDFIRST
  235. #include \<dos.h>
  236. unsigned _dos_findfirst( char *path,
  237.              unsigned attributes,
  238.              struct find_t *buffer );
  239. struct find_t {
  240.   char reserved[21];      /* reserved for use by DOS   */
  241.   char attrib;          /* attribute byte for file   */
  242.   unsigned short wr_time; /* time of last write to file*/
  243.   unsigned short wr_date; /* date of last write to file*/
  244.   unsigned long  size;      /* length of file in bytes   */
  245.   char name[13];      /* null-terminated filename  */
  246. };
  247.  
  248. The   _dos_findfirst   function   uses    system    call  0x4E  to    return
  249. information  on the  first  file whose name and  attributes  match the
  250. "path" and "attributes" arguments.    The information is returned in a
  251. find_t    structure  pointed  to by  "buffer".  The "path"  argument may
  252. contain wildcard characters ('?' and '*').   The "attributes" argument
  253. may be any combination of the following constants:
  254.  
  255. _A_NORMAL      Indicates a normal file.    File can be read or written
  256.            without any restrictions.
  257.  
  258. _A_RDONLY      Indicates a read-only file.   File cannot be opened for
  259.            "write".
  260.  
  261. _A_HIDDEN      Indicates a hidden file.  This file will not show up in
  262.            a normal directory search.
  263.  
  264. _A_SYSTEM      Indicates a system file.  This file will not show up in
  265.            a normal directory search.
  266.  
  267. _A_VOLID       Indicates a volume-ID.
  268.  
  269. _A_SUBDIR      Indicates a sub-directory.
  270.  
  271. _A_ARCH        This is the archive flag.   It is set whenever the file
  272.            is  modified,  and  is  cleared    by the    MS-DOS    BACKUP
  273.            command and other backup utility programs.
  274. ::::_DOS_FINDNEXT
  275. #include \<dos.h>
  276. unsigned _dos_findnext( struct find_t *buffer );
  277.  
  278. struct find_t {
  279.   char reserved[21];      /* reserved for use by DOS   */
  280.   char attrib;          /* attribute byte for file   */
  281.   unsigned short wr_time; /* time of last write to file*/
  282.   unsigned short wr_date; /* date of last write to file*/
  283.   unsigned long  size;      /* length of file in bytes   */
  284.   char name[13];      /* null-terminated filename  */
  285. };
  286.  
  287. The _dos_findnext function uses system call 0x4F to return information
  288. on the next file whose name and  attributes match the pattern supplied
  289. to the _dos_findfirst function.    The function _dos_findfirst must be
  290. called    before _dos_findnext to get information on the first file that
  291. matches.  The information is returned in a find_t structure pointed to
  292. by "buffer".
  293. ::::_DOS_FREEMEM
  294. #include \<dos.h>
  295. unsigned _dos_freemem( unsigned segment );
  296.  
  297. The _dos_freemem function uses system call 0x49 to release memory that
  298. was previously    allocated by  _dos_allocmem.   The value  contained in
  299. "segment" is the one returned by a previous call to _dos_allocmem.
  300. ::::_DOS_GETDATE
  301. #include \<dos.h>
  302. void _dos_getdate( struct dosdate_t *date );
  303.  
  304. struct dosdate_t {
  305.     unsigned char day;    /* 1-31 */
  306.     unsigned char month;    /* 1-12 */
  307.     unsigned short year;    /* 1980-2099 */
  308.     unsigned char dayofweek;/* 0-6 (0=Sunday) */
  309. };
  310.  
  311. The  _dos_getdate  function  uses  system call 0x2A to get the current
  312. system    date.     The  date  information  is  returned  in a  dosdate_t
  313. structure pointed to by "date".
  314. ::::_DOS_GETDISKFREE
  315. #include \<dos.h>
  316. unsigned _dos_getdiskfree( unsigned drive,
  317.             struct diskfree_t *diskspace );
  318. struct diskfree_t {
  319.     unsigned short total_clusters;
  320.     unsigned short avail_clusters;
  321.     unsigned short sectors_per_cluster;
  322.     unsigned short bytes_per_sector;
  323. };
  324.  
  325. The  _dos_getdiskfree  function uses system call 0x36 to obtain useful
  326. information  on the disk drive specified by "drive". Specify 0 for the
  327. default  drive, 1 for  drive A, 2 for  drive B, etc.   The information
  328. about the drive is  returned in the structure diskfree_t pointed to by
  329. "diskspace".
  330. ::::_DOS_GETDRIVE
  331. #include \<dos.h>
  332. void _dos_getdrive( unsigned *drive );
  333.  
  334. The  _dos_getdrive  function  uses system call 0x19 to get the current
  335. disk drive number.    The current disk drive number is returned in the
  336. word  pointed  to by "drive". A value of 1 is drive A, 2 is drive B, 3
  337. is drive C, etc.
  338. ::::_DOS_GETFILEATTR
  339. #include \<dos.h>
  340. unsigned _dos_getfileattr( char *path,
  341.                unsigned *attributes );
  342.  
  343. The _dos_getfileattr function uses system call 0x43 to get the current
  344. attributes  of the  file or  directory    that  "path"  points to.   The
  345. possible attributes are:
  346.  
  347. _A_NORMAL      Indicates a normal file.    File can be read or written
  348.            without any restrictions.
  349.  
  350. _A_RDONLY      Indicates a read-only file.   File cannot be opened for
  351.            "write".
  352.  
  353. _A_HIDDEN      Indicates a hidden file.  This file will not show up in
  354.            a normal directory search.
  355.  
  356. _A_SYSTEM      Indicates a system file.  This file will not show up in
  357.            a normal directory search.
  358.  
  359. _A_VOLID       Indicates a volume-ID.
  360.  
  361. _A_SUBDIR      Indicates a sub-directory.
  362.  
  363. _A_ARCH        This is the archive flag.   It is set whenever the file
  364.            is  modified,  and  is  cleared    by the    MS-DOS    BACKUP
  365.            command and other backup utility programs.
  366. ::::_DOS_GETFTIME
  367. #include \<dos.h>
  368. unsigned _dos_getftime( int handle,
  369.             unsigned short *date,
  370.             unsigned short *time );
  371.  
  372. The  _dos_getftime  function uses system call 0x57 to get the date and
  373. time that the file  associated    with "handle" was last modified.   The
  374. date  consists    of the    year,  month  and  day packed  into 16 bits as
  375. follows:
  376.  
  377. bits 0-4  Day (1-31)
  378. bits 5-8  Month (1-12)
  379. bits 9-15 Year (0-119 representing 1980-2099)
  380.  
  381. The time  consists  of the hour,  minute and  seconds/2 packed into 16
  382. bits as follows:
  383.  
  384. bits 0-4  Seconds/2 (0-29)
  385. bits 5-10 Minutes (0-59)
  386. bits 11-15 Hours (0-23)
  387. ::::_DOS_GETTIME
  388. #include \<dos.h>
  389. void _dos_gettime( struct dostime_t *time );
  390.  
  391. struct dostime_t {
  392.     unsigned char hour;    /* 0-23 */
  393.     unsigned char minute;    /* 0-59 */
  394.     unsigned char second;    /* 0-59 */
  395.     unsigned char hsecond;    /* 1/100 second; 0-99 */
  396. };
  397.  
  398. The  _dos_gettime  function  uses  system call 0x2C to get the current
  399. system    time.     The  time  information  is  returned  in a  dostime_t
  400. structure pointed to by "time".
  401. ::::_DOS_GETVECT
  402. #include \<dos.h>
  403. void (__interrupt __far *_dos_getvect(unsigned intnum))();
  404.  
  405. The  _dos_getvect  function gets the current value of interrupt vector
  406. number "intnum".
  407. ::::_DOS_KEEP
  408. #include \<dos.h>
  409. void _dos_keep( unsigned retcode, unsigned memsize );
  410.  
  411. The _dos_keep  function is used to install terminate-and-stay-resident
  412. programs  ("TSR's")  in  memory.   The    amount of memory  kept for the
  413. program  is  "memsize"    paragraphs  (a paragraph is 16 bytes) from the
  414. Program  Segment  Prefix  which is stored in the  variable _psp.   The
  415. value of "retcode" is returned to the parent process.
  416. ::::_DOS_OPEN
  417. #include \<dos.h>
  418. unsigned _dos_open( char *path,
  419.             unsigned mode,
  420.             int *handle );
  421.  
  422. The  _dos_open    function  uses    system    call  0x3D  to    open  the file
  423. specified  by  "path,"    which must be an  existing  file.   The "mode"
  424. argument   specifies  the  file's  access,   sharing  and  inheritance
  425. permissions.  The access mode must be one of:
  426.  
  427. O_RDONLY      Read only
  428. O_WRONLY      Write only
  429. O_RDWR          Both read and write
  430.  
  431. The sharing permissions, if specified, must be one of:
  432.  
  433. SH_COMPAT      Compatibility mode
  434. SH_DENYRW      Deny reading and writing
  435. SH_DENYRW      Deny writing
  436. SH_DENYRD      Deny reading
  437. SH_DENYNONE      Deny neither
  438.  
  439. The inheritance permission, if specified, is:
  440.  
  441. O_NOINHERIT      File is not inherited by a child process
  442. ::::_DOS_READ
  443. #include \<dos.h>
  444. unsigned _dos_read( int handle, void __far *buffer,
  445.             unsigned count, unsigned *bytes );
  446.  
  447. The  _dos_read function uses system call 0x3F to read "count" bytes of
  448. data from the file specified by "handle" into the buffer pointed to by
  449. "buffer".  The number of bytes successfully read will be stored in the
  450. unsigned integer pointed to by "bytes".
  451. ::::_DOS_SETBLOCK
  452. #include \<dos.h>
  453. unsigned _dos_setblock( unsigned size, unsigned segment,
  454.             unsigned *maxsize );
  455.  
  456. The _dos_setblock function uses system call 0x4A to change the size of
  457. "segment,"  which was previously allocated by _dos_allocmem, to "size"
  458. paragraphs.   If the request  fails, the maximum  number of paragraphs
  459. that  this  memory  block  can be changed to is  returned  in the word
  460. pointed to by "maxsize".
  461. ::::_DOS_SETDATE
  462. #include \<dos.h>
  463. unsigned _dos_setdate( struct dosdate_t *date );
  464.  
  465. struct dosdate_t {
  466.     unsigned char day;    /* 1-31 */
  467.     unsigned char month;    /* 1-12 */
  468.     unsigned short year;    /* 1980-2099 */
  469.     unsigned char dayofweek;/* 0-6 (0=Sunday) */
  470. };
  471.  
  472. The  _dos_setdate  function  uses  system call 0x2B to set the current
  473. system date.   The date information is passed in a dosdate_t structure
  474. pointed to by "date".
  475. ::::_DOS_SETDRIVE
  476. #include \<dos.h>
  477. void _dos_setdrive( unsigned drive, unsigned *total );
  478.  
  479. The  _dos_setdrive  function  uses system call 0x0E to set the current
  480. default  disk drive to be the drive  specified    by  "drive," where 1 =
  481. drive  A, 2 = drive B, etc.    The  total  number  of disk  drives  is
  482. returned in the word pointed to by "total".
  483. ::::_DOS_SETFILEATTR
  484. #include \<dos.h>
  485. unsigned _dos_setfileattr( char *path,
  486.                unsigned attributes );
  487.  
  488. The  _dos_setfileattr  function  uses  system  call  0x43  to set  the
  489. attributes  of the  file or  directory    that  "path"  points to.   The
  490. possible attributes are:
  491.  
  492. _A_NORMAL      Indicates a normal file.    File can be read or written
  493.            without any restrictions.
  494.  
  495. _A_RDONLY      Indicates a read-only file.   File cannot be opened for
  496.            "write".
  497.  
  498. _A_HIDDEN      Indicates a hidden file.  This file will not show up in
  499.            a normal directory search.
  500.  
  501. _A_SYSTEM      Indicates a system file.  This file will not show up in
  502.            a normal directory search.
  503.  
  504. _A_VOLID       Indicates a volume-ID.
  505.  
  506. _A_SUBDIR      Indicates a sub-directory.
  507.  
  508. _A_ARCH        This is the archive flag.   It is set whenever the file
  509.            is  modified,  and  is  cleared    by the    MS-DOS    BACKUP
  510.            command and other backup utility programs.
  511. ::::_DOS_SETFTIME
  512. #include \<dos.h>
  513. unsigned _dos_setftime( int handle,
  514.             unsigned short date,
  515.             unsigned short time );
  516.  
  517. The  _dos_setftime  function uses system call 0x57 to set the date and
  518. time that the file  associated    with "handle" was last modified.   The
  519. date  consists    of the    year,  month  and  day packed  into 16 bits as
  520. follows:
  521.  
  522. bits 0-4  Day (1-31)
  523. bits 5-8  Month (1-12)
  524. bits 9-15 Year (0-119 representing 1980-2099)
  525.  
  526. The time  consists  of the hour,  minute and  seconds/2 packed into 16
  527. bits as follows:
  528.  
  529. bits 0-4  Seconds/2 (0-29)
  530. bits 5-10 Minutes (0-59)
  531. bits 11-15 Hours (0-23)
  532. ::::_DOS_SETTIME
  533. #include \<dos.h>
  534. unsigned _dos_settime( struct dostime_t *time );
  535. struct dostime_t {
  536.     unsigned char hour;    /* 0-23 */
  537.     unsigned char minute;    /* 0-59 */
  538.     unsigned char second;    /* 0-59 */
  539.     unsigned char hsecond;    /* 1/100 second; 0-99 */
  540. };
  541.  
  542. The  _dos_settime  function  uses  system call 0x2D to set the current
  543. system time.   The time information is passed in a dostime_t structure
  544. pointed to by "time".
  545. ::::_DOS_SETVECT
  546. #include \<dos.h>
  547. void _dos_setvect( unsigned intnum,
  548.            void (__interrupt __far *handler)() );
  549.  
  550. The  _dos_setvect  function sets interrupt  vector number  "intnum" to
  551. point to the interrupt handling function pointed to by "handler".
  552. ::::_DOS_WRITE
  553. #include \<dos.h>
  554. unsigned _dos_write( int handle, void __far *buffer,
  555.              unsigned count, unsigned *bytes );
  556.  
  557. The  _dos_write  function uses system call 0x40 to write "count" bytes
  558. of data from the buffer  pointed to by    "buffer" to the file specified
  559. by "handle".  The number of bytes  successfully written will be stored
  560. in the unsigned integer pointed to by "bytes".
  561. ::::_ENABLE
  562. #include \<dos.h>
  563. void _enable( void );
  564.  
  565. The _enable function causes interrupts to become enabled.
  566.  
  567. The _enable  function  would be used in  conjunction with the _disable
  568. function  to make sure that a sequence    of  instructions  are executed
  569. without any intervening interrupts occurring.
  570. ::::_ENDTHREAD
  571. #include \<process.h>
  572. void __far _endthread(void);
  573.  
  574. The  _endthread  function  uses the OS/2  function  DosExit to end the
  575. current thread of execution.
  576. ::::_EXIT
  577. #include \<stdlib.h>
  578. void _exit( int status );
  579.  
  580. The _exit function causes normal program termination to occur.
  581.  
  582.    1. The  functions  registered by the atexit or onexit functions are
  583.       not called.
  584.  
  585.    2. Any unopened files are not closed and any buffered output is not
  586.       flushed to the associated files or devices.
  587.  
  588.    3. Any files created by tmpfile are not removed.
  589.  
  590.    4. The  low-order  byte of "status" is made available to the parent
  591.       process.      The "status" value is typically set to 0 to indicate
  592.       successful  termination  and set to some other value to indicate
  593.       an error.
  594. ::::_EXPAND
  595. #include \<malloc.h>
  596. void        * _expand(void      *mem_blk,size_t size);
  597. void __far  *_fexpand(void __far  *mem_blk,size_t size);
  598. void __near *_nexpand(void __near *mem_blk,size_t size);
  599.  
  600. The  _expand  function    changes the size of the  previously  allocated
  601. block  pointed to by "mem_blk" by attempting to expand or contract the
  602. memory    block  without moving its location in the heap.   The argument
  603. "size"    specifies  the new  desired  size for the memory  block.   The
  604. contents  of the memory  block are  unchanged up to the shorter of the
  605. new and old sizes.
  606.  
  607. The  _nexpand  function  expands  memory  in the  near    heap,  and the
  608. _fexpand function expands memory in the far heap.
  609.  
  610. In a small data  memory  model, the  _expand function is equivalent to
  611. the  _nexpand  function;  in a large data  memory  model, the  _expand
  612. function is equivalent to the _fexpand function.
  613. ::::_FEXPAND
  614.  ->_EXPAND
  615. ::::_FFREE
  616. #include \<malloc.h>
  617. void _ffree( void __far *ptr );
  618.  
  619. When the value of the argument "ptr" is NULL, the _ffree function does
  620. nothing  otherwise, the _ffree    function  deallocates the memory block
  621. located  by  the  argument  "ptr"  which  points  to  a  memory  block
  622. previously allocated through a call to _fmalloc function.    After the
  623. call, the freed block is available for allocation.
  624.  
  625. In a large data memory model, the _ffree function is equivalent to the
  626. free function.
  627. ::::_FHEAPCHK
  628.  ->_HEAPCHK
  629. ::::_FHEAPGROW
  630.  ->_HEAPGROW
  631. ::::_FHEAPMIN
  632.  ->_HEAPMIN
  633. ::::_FHEAPSET
  634.  ->_HEAPSET
  635. ::::_FHEAPSHRINK
  636.  ->_HEAPSHRINK
  637. ::::_FHEAPWALK
  638.  ->_HEAPWALK
  639. ::::_FMALLOC
  640. #include \<malloc.h>
  641. void __far *_fmalloc( size_t size );
  642.  
  643. The _fmalloc  function    allocates space for an object of "size" bytes.
  644. Nothing is allocated when "size" is zero.
  645.  
  646. In a  small  data  memory  model, the _fmalloc    function  acquires the
  647. memory    block  outside    the default data  segment, if  available,  and
  648. inside the default memory block otherwise.   This means that the total
  649. allocations are not limited by the 64K restriction associated with the
  650. default data segment.
  651.  
  652. In a large data memory    model, the _fmalloc  function is equivalent to
  653. the malloc function.
  654.  
  655. Blocks    allocated with the _fmalloc  function  should be  de-allocated
  656. using the _ffree function.
  657. ::::_FMEMCCPY
  658.  ->MEMCCPY
  659. ::::_FMEMCHR
  660.  ->MEMCHR
  661. ::::_FMEMCMP
  662.  ->MEMCMP
  663. ::::_FMEMCPY
  664.  ->MEMCPY
  665. ::::_FMEMICMP
  666.  ->MEMICMP
  667. ::::_FMEMMOVE
  668.  ->MEMMOVE
  669. ::::_FMEMSET
  670.  ->MEMSET
  671. ::::_FMSIZE
  672.  ->_MSIZE
  673. ::::_FPRESET
  674. #include \<float.h>
  675. void _fpreset( void );
  676.  
  677. The  _fpreset  function  should  be called  before the    floating-point
  678. operations are attempted.
  679. ::::_FREALLOC
  680. #include \<malloc.h>
  681. void __far *_frealloc(void __far  *old_blk, size_t size);
  682.  
  683. When  the  value  of the  "old_blk"  argument  is NULL, a new block of
  684. memory of "size" bytes is allocated.
  685.  
  686. If the value of "size" is zero,  _frealloc  calls the free function to
  687. release the memory pointed to by "old_blk".
  688.  
  689. Otherwise, the _frealloc  function re-allocates space for an object of
  690. "size" bytes by either:
  691.  
  692.    * shrinking    the  allocated    size  of the  allocated  memory  block
  693.     "old_blk"  when  "size" is    sufficiently  smaller than the size of
  694.     "old_blk".
  695.  
  696.    * extending    the  allocated    size  of the  allocated  memory  block
  697.     "old_blk"  if there is a large  enough block of unallocated memory
  698.     immediately following "old_blk".
  699.  
  700.    * allocating  a new block and  copying the contents of "old_blk" to
  701.     the new block.
  702.  
  703. Because it is  possible  that a new block will be  allocated, no other
  704. pointers  should point into the memory of  "old_blk".  These  pointers
  705. will point to freed  memory, with  possible disastrous results, when a
  706. new block is allocated.
  707.  
  708. The  memory  pointed  to by  "old_blk"    is not    freed  if it cannot be
  709. re-allocated.
  710.  
  711. The  _frealloc    function  reallocates  memory  in the  far heap.    If
  712. _frealloc  cannot  reallocate  the memory in the far heap, it will try
  713. the near heap.
  714.  
  715. In a large data memory    model, the _frealloc function is equivalent to
  716. the realloc function.
  717.  
  718. The  _frealloc    function  is a    WATCOM    extension  to the  standard  C
  719. library.
  720. ::::_FREECT
  721. #include \<malloc.h>
  722. unsigned int _freect( size_t size );
  723.  
  724. The  _freect  function    returns the number of times that  _nmalloc (or
  725. malloc    in  small  data  models)  can be called to  allocate a item of
  726. "size"    bytes.     In the  tiny,    small and medium  memory  models,  the
  727. default  data  segment is only    extended as needed to satisfy requests
  728. for memory allocation.    Therefore, you will need to call _nheapgrow in
  729. these  memory  models  before  calling    _freect  in  order  to    get  a
  730. meaningful result.
  731. ::::_FSTRCAT
  732.  ->STRCAT
  733. ::::_FSTRCHR
  734.  ->STRCHR
  735. ::::_FSTRCMP
  736.  ->STRCMP
  737. ::::_FSTRCPY
  738.  ->STRCPY
  739. ::::_FSTRCSPN
  740.  ->STRCSPN
  741. ::::_FSTRICMP
  742.  ->STRICMP
  743. ::::_FSTRLEN
  744.  ->STRLEN
  745. ::::_FSTRLWR
  746.  ->STRLWR
  747. ::::_FSTRNCAT
  748.  ->STRNCAT
  749. ::::_FSTRNCMP
  750.  ->STRNCMP
  751. ::::_FSTRNCPY
  752.  ->STRNCPY
  753. ::::_FSTRNICMP
  754.  ->STRNICMP
  755. ::::_FSTRNSET
  756.  ->STRNSET
  757. ::::_FSTRPBRK
  758.  ->STRPBRK
  759. ::::_FSTRRCHR
  760.  ->STRRCHR
  761. ::::_FSTRREV
  762.  ->STRREV
  763. ::::_FSTRSET
  764.  ->STRSET
  765. ::::_FSTRSPN
  766.  ->STRSPN
  767. ::::_FSTRSTR
  768.  ->STRSTR
  769. ::::_FSTRTOK
  770.  ->STRTOK
  771. ::::_FSTRUPR
  772.  ->STRUPR
  773. ::::_FULLPATH
  774. #include \<stdlib.h>
  775. void _fullpath( char *buff,
  776.         const char *path,
  777.         size_t size );
  778.  
  779. The   _fullpath  function  returns  the  full  pathname  of  the  file
  780. specification  in  "path"  in the  specified  buffer  "buff" of length
  781. "size".
  782.  
  783. The  maximum  size that might be required for "buff" is PATH_MAX.   If
  784. the buffer  provided  is too small, NULL is returned and errno is set.
  785. If "buff" is NULL then a buffer of size  PATH_MAX  is  allocated using
  786. malloc.
  787.  
  788. If  "path"  is NULL or    points    to a null string ("") then the current
  789. working directory is returned in "buff".
  790. ::::_HARDERR
  791. #include \<dos.h>
  792. void _harderr( int (__far *funcptr)() );
  793. void _hardresume( int action );
  794.  
  795. The _harderr  routine installs a critical error handler (for INT 0x24)
  796. to handle hardware errors.   This critical error handler will call the
  797. function  specified  by  "funcptr"  when a critical  error occurs (for
  798. example,  attempting  to open a file on a floppy  disk    when the drive
  799. door is open).    The parameters to this function are as follows:
  800.  
  801. int handler( unsigned deverror,
  802.          unsigned errcode,
  803.          unsigned __far *devhdr );
  804.  
  805. The low-order byte of "errcode" can be one of the following values:
  806.  
  807. 0x00   Attempt to write to a write-protected disk
  808. 0x01   Unknown unit
  809. 0x02   Drive not ready
  810. 0x03   Unknown command
  811. 0x04   CRC error in data
  812. 0x05   Bad drive-request structure length
  813. 0x06   Seek error
  814. 0x07   Unknown media type
  815. 0x08   Sector not found
  816. 0x09   Printer out of paper
  817. 0x0A   Write fault
  818. 0x0B   Read fault
  819. 0x0C   General failure
  820.  
  821. The "devhdr"  argument    points to a device  header  control-block that
  822. contains  information  about  the device on which the error  occurred.
  823. Your error  handler may inspect the  information in this control-block
  824. but must not change it.
  825.  
  826. If the    error  occurred  on a disk  device,  bit 15 of the  "deverror"
  827. argument  will be 0 and the  "deverror"  argument  will  indicate  the
  828. following:
  829.  
  830. bit 15 0 indicates disk error
  831. bit 14 not used
  832. bit 13 0 indicates "Ignore" response not allowed
  833. bit 12 0 indicates "Retry" response not allowed
  834. bit 11 0 indicates "Fail" response not allowed
  835. bit 9,10 location of error
  836.  
  837.        00     MS-DOS
  838.        01     File Allocation Table (FAT)
  839.        10     Directory
  840.        11     Data area
  841. bit 8  0 indicates read error, 1 indicates write error
  842.  
  843. The  low-order    byte of "deverror" indicates the drive where the error
  844. occurred; (0 = drive A, 1 = drive B, etc.).
  845.  
  846. The handler is very restricted in the type of system calls that it can
  847. perform.  System calls 0x01 through 0x0C, and 0x59 are the only system
  848. calls  allowed to be issued by the  handler.   Therefore,  many of the
  849. standard C run-time  functions    such as stream I/O and    low-level  I/O
  850. cannot be used by the handler.     Console I/O is allowed (eg.  cprintf,
  851. cputs).
  852.  
  853. The  handler must indicate what action to take by returning one of the
  854. following  values  or calling  _hardresume  with one of the  following
  855. values:
  856.  
  857. _HARDERR_IGNORE       Ignore the error
  858.  
  859. _HARDERR_RETRY          Retry the operation
  860.  
  861. _HARDERR_ABORT          Abort the program issuing INT 0x23
  862.  
  863. _HARDERR_FAIL          Fail the system  call that is in    progress  (DOS
  864.               3.0 or higher)
  865.  
  866. See  The  MS-DOS   Encyclopedia   for  more  detailed  information  on
  867. determining the type of error that has occurred.
  868. ::::_HARDRESUME
  869.  ->_HARDERR
  870. ::::_HEAPCHK
  871. #include \<malloc.h>
  872. int  _heapchk( void );
  873. int _nheapchk( void );
  874. int _fheapchk( void );
  875.  
  876. The _heapchk  function    along with _heapset and _heapwalk are provided
  877. for debugging heap related problems in programs.
  878.  
  879. The _heapchk  function    does a    consistency  check on the  unallocated
  880. memory space or "heap".   The consistency check determines whether all
  881. the heap entries are valid.   The  _nheapchk  function checks the near
  882. heap and the _fheapchk function checks the far heap.
  883.  
  884. In a small data memory    model, the _heapchk  function is equivalent to
  885. the  _nheapchk    function;  in a large data memory  model, the _heapchk
  886. function is equivalent to the _fheapchk function.
  887. ::::_HEAPGROW
  888. #include \<malloc.h>
  889. void  _heapgrow( void );
  890. void _nheapgrow( void );
  891. void _fheapgrow( void );
  892.  
  893. The  _nheapgrow function attempts to grow the near heap to the maximum
  894. size of 64K.  You will want to do this in the small data models if you
  895. are using both malloc and _fmalloc or halloc.  Once a call to _fmalloc
  896. or  halloc  has been  made, you may not be able to allocate any memory
  897. with  malloc  unless  space has been  reserved for the near heap using
  898. either malloc, sbrk or _nheapgrow.
  899.  
  900. The  _fheapgrow  function  doesn't do anything to the heap because the
  901. far heap will be extended automatically when needed.    If the current
  902. far heap cannot be extended, then another far heap will be started.
  903.  
  904. In a small data memory    model, the _heapgrow function is equivalent to
  905. the  _nheapgrow  function; in a large data memory model, the _heapgrow
  906. function is equivalent to the _fheapgrow function.
  907. ::::_HEAPMIN
  908. #include \<malloc.h>
  909. int  _heapmin( void );
  910. int _nheapmin( void );
  911. int _fheapmin( void );
  912.  
  913. The  _heapmin  function  attempts  to shrink the heap to its  smallest
  914. possible  size by  returning  all free    entries at the end of the heap
  915. back to the  system.   This can be used to free up as much  memory  as
  916. possible  before  using  the  system  function    or  one  of the  spawn
  917. functions.
  918.  
  919. In a small data memory    model, the _heapmin  function is equivalent to
  920. the  _nheapmin    function;  in a large data memory  model, the _heapmin
  921. function is equivalent to the _fheapmin function.   It is identical to
  922. the _heapshrink function.
  923. ::::_HEAPSET
  924. #include \<malloc.h>
  925. int  _heapset( unsigned char fill_char );
  926. int _nheapset( unsigned char fill_char );
  927. int _fheapset( unsigned char fill_char );
  928.  
  929. The _heapset  function    along with _heapchk and _heapwalk are provided
  930. for debugging heap related problems in programs.
  931.  
  932. The _heapset  function    does a    consistency  check on the  unallocated
  933. memory space or "heap" just as _heapchk does, and sets the heap's free
  934. entries  with the  "fill_char"    value.     The  _nheapset  function sets
  935. entries in the near heap and the  _fheapset  function  sets entries in
  936. the far heap.
  937.  
  938. In a small data memory    model, the _heapset  function is equivalent to
  939. the  _nheapset    function;  in a large data memory  model, the _heapset
  940. function is equivalent to the _fheapset function.
  941. ::::_HEAPSHRINK
  942. #include \<malloc.h>
  943. int  _heapshrink( void );
  944. int _nheapshrink( void );
  945. int _fheapshrink( void );
  946.  
  947. The  _heapshrink  function attempts to shrink the heap to its smallest
  948. possible  size by  returning  all free    entries at the end of the heap
  949. back to the  system.   This can be used to free up as much  memory  as
  950. possible  before  using  the  system  function    or  one  of the  spawn
  951. functions.
  952.  
  953. In a small data memory    model, the  _heapshrink function is equivalent
  954. to the    _nheapshrink  function;  in a  large  data  memory  model, the
  955. _heapshrink function is equivalent to the _fheapshrink function.    It
  956. is identical to the _heapmin function.
  957. ::::_HEAPWALK
  958. #include \<malloc.h>
  959. int  _heapwalk( struct _heapinfo *entry );
  960. int _nheapwalk( struct _heapinfo *entry );
  961. int _fheapwalk( struct _heapinfo *entry );
  962.  
  963. struct _heapinfo {
  964.     void __far *_pentry;   /* heap pointer */
  965.     size_t     _size;       /* heap entry size */
  966.     int        _useflag;   /* heap entry 'in-use' flag */
  967. };
  968. #define _USEDENTRY    0
  969. #define _FREEENTRY    1
  970.  
  971. The  _heapwalk    function along with _heapchk and _heapset are provided
  972. for debugging heap related problems in programs.
  973.  
  974. The  _heapwalk    function  walks  through the heap, one entry per call,
  975. returning a pointer to a _heapinfo structure that contains information
  976. on the next heap entry.   The structure is defined in \<malloc.h>.  The
  977. _nheapwalk  function  walks  through the near heap and the  _fheapwalk
  978. function walks through the far heap.
  979.  
  980. On 16-bit 80x86  systems, the  _heapwalk function is equivalent to the
  981. _nheapwalk function in a small data memory model; and is equivalent to
  982. the _fheapwalk function in a large data memory model.
  983. ::::_LROTL
  984. #include \<stdlib.h>
  985. unsigned long _lrotl( unsigned long value,
  986.               unsigned int shift );
  987.  
  988. The _lrotl  function  rotates the unsigned long integer, determined by
  989. "value," to the left by the number of bits specified in "shift".
  990. ::::_LROTR
  991. #include \<stdlib.h>
  992. unsigned long _lrotr( unsigned long value,
  993.               unsigned int shift );
  994.  
  995. The _lrotr  function  rotates the unsigned long integer, determined by
  996. "value," to the right by the number of bits specified in "shift".
  997. ::::_MAKEPATH
  998. #include \<stdlib.h>
  999. void _makepath( char *path,
  1000.         const char *drive,
  1001.         const char *dir,
  1002.         const char *fname,
  1003.         const char *ext );
  1004.  
  1005. The  _makepath function constructs a full pathname from the components
  1006. consisting  of a drive letter, directory path, file name and file name
  1007. extension.   The full  pathname  is placed in the buffer pointed to by
  1008. the argument "path".
  1009.  
  1010. The maximum size required for each buffer is specified by the manifest
  1011. constants  _MAX_PATH,  _MAX_DRIVE,  _MAX_DIR, _MAX_FNAME, and _MAX_EXT
  1012. which are defined in \<stdlib.h>.
  1013.  
  1014. drive      The "drive" argument points to a buffer containing the drive
  1015.       letter (A, B, C, etc.) followed by an optional colon.    The
  1016.       _makepath  function will automatically insert a colon in the
  1017.       full    pathname  if  it is  missing.    If  "drive"  is a NULL
  1018.       pointer  or  points to an empty  string, no drive  letter or
  1019.       colon will be placed in the full pathname.
  1020.  
  1021. dir      The "dir"  argument  points to a buffer  containing just the
  1022.       pathname.  Either forward slashes (/) or backslashes (\) may
  1023.       be used.   The trailing  slash is optional.    The  _makepath
  1024.       function  will  automatically insert a trailing slash in the
  1025.       full pathname if it is missing.   If "dir" is a NULL pointer
  1026.       or points to an empty string, no slash will be placed in the
  1027.       full pathname.
  1028.  
  1029. fname      The "fname"  argument points to a buffer containing the base
  1030.       name of the file without any extension (suffix).
  1031.  
  1032. ext      The  "ext"  argument    points    to  a  buffer  containing  the
  1033.       filename  extension  or  suffix.   A    leading  period (.) is
  1034.       optional.  The _makepath routine will automatically insert a
  1035.       period in the full pathname if it is missing.  If "ext" is a
  1036.       NULL pointer or points to an empty string, no period will be
  1037.       placed in the full pathname.
  1038. ::::_MEMAVL
  1039. #include \<malloc.h>
  1040. size_t _memavl( void );
  1041.  
  1042. The _memavl  function  returns the number of bytes of memory available
  1043. for  dynamic  memory  allocation  in the  near    heap (the default data
  1044. segment).   In the tiny,  small and medium  memory models, the default
  1045. data segment is only extended as needed to satisfy requests for memory
  1046. allocation.   Therefore,  you  will need to call  _nheapgrow  in these
  1047. memory    models    before    calling  _memavl in order to get a  meaningful
  1048. result.
  1049.  
  1050. The number  returned by _memavl may not  represent a single contiguous
  1051. block  of  memory.    Use the  _memmax    function  to find the  largest
  1052. contiguous block of memory that can be allocated.
  1053. ::::_MEMMAX
  1054. #include \<malloc.h>
  1055. size_t _memmax( void );
  1056.  
  1057. The _memmax  function returns the size of the largest contiguous block
  1058. of memory  available  for dynamic  memory  allocation in the near heap
  1059. (the  default  data  segment).     In the tiny,  small and medium memory
  1060. models, the default data segment is only extended as needed to satisfy
  1061. requests  for  memory  allocation.   Therefore,  you will need to call
  1062. _nheapgrow  in these memory  models before calling _memmax in order to
  1063. get a meaningful result.
  1064.  
  1065. ::::_MSIZE
  1066. #include \<malloc.h>
  1067. size_t _msize( void *buffer );
  1068. size_t _fmsize( void __far *buffer );
  1069. size_t _nmsize( void __near *buffer );
  1070.  
  1071. The _msize function returns the size of the memory block pointed to by
  1072. "buffer" that was allocated by a call to calloc, malloc, or realloc.
  1073.  
  1074. In small data models  (small and medium memory models), _msize maps to
  1075. _nmsize.    In    large  data  models  (compact,    large  and huge memory
  1076. models), _msize maps to _fmsize.
  1077.  
  1078. The _nmsize function returns the size of the memory block allocated by
  1079. a call to _nmalloc.
  1080.  
  1081. The _fmsize function returns the size of the memory block allocated by
  1082. a call to _fmalloc.
  1083. ::::_NEXPAND
  1084.  ->_EXPAND
  1085. ::::_NFREE
  1086. #include \<malloc.h>
  1087. void _nfree( void __near *ptr );
  1088.  
  1089. When the value of the argument "ptr" is NULL, the _nfree function does
  1090. nothing  otherwise, the _nfree    function  deallocates the memory block
  1091. located  by  the  argument  "ptr"  which  points  to  a  memory  block
  1092. previously allocated through a call to _nmalloc function.    After the
  1093. call, the freed block is available for allocation.
  1094.  
  1095. In a small data memory model, the _nfree function is equivalent to the
  1096. free function.
  1097. ::::_NHEAPCHK
  1098.  ->_HEAPCHK
  1099. ::::_NHEAPGROW
  1100.  ->_HEAPGROW
  1101. ::::_NHEAPMIN
  1102.  ->_HEAPMIN
  1103. ::::_NHEAPSET
  1104.  ->_HEAPSET
  1105. ::::_NHEAPSHRINK
  1106.  ->_HEAPSHRINK
  1107. ::::_NHEAPWALK
  1108.  ->_HEAPWALK
  1109. ::::_NMALLOC
  1110. #include \<malloc.h>
  1111. void __near *_nmalloc( size_t size );
  1112.  
  1113. The _nmalloc  function    allocates space for an object of "size" bytes.
  1114. Nothing is allocated when "size" is zero.
  1115.  
  1116. The  _nmalloc  function  acquires  the memory block inside the default
  1117. data  segment.     This means that the total  allocations are limited by
  1118. the 64K restriction associated with the default data segment.
  1119.  
  1120. In a small data memory    model, the _nmalloc  function is equivalent to
  1121. the malloc function.
  1122.  
  1123. Blocks    allocated with the _nmalloc  function  should be  de-allocated
  1124. using the _nfree function.
  1125. ::::_NMSIZE
  1126.  ->_MSIZE
  1127. ::::_NREALLOC
  1128. #include \<malloc.h>
  1129. void __near *_nrealloc(void __near *old_blk, size_t size);
  1130.  
  1131. When  the  value  of the  "old_blk"  argument  is NULL, a new block of
  1132. memory of "size" bytes is allocated.
  1133.  
  1134. If the value of "size" is zero,  _nrealloc  calls the free function to
  1135. release the memory pointed to by "old_blk".
  1136.  
  1137. Otherwise, the _nrealloc  function re-allocates space for an object of
  1138. "size" bytes by either:
  1139.  
  1140.    * shrinking    the  allocated    size  of the  allocated  memory  block
  1141.     "old_blk"  when  "size" is    sufficiently  smaller than the size of
  1142.     "old_blk".
  1143.  
  1144.    * extending    the  allocated    size  of the  allocated  memory  block
  1145.     "old_blk"  if there is a large  enough block of unallocated memory
  1146.     immediately following "old_blk".
  1147.  
  1148.    * allocating  a new block and  copying the contents of "old_blk" to
  1149.     the new block.
  1150.  
  1151. Because it is  possible  that a new block will be  allocated, no other
  1152. pointers  should point into the memory of  "old_blk".  These  pointers
  1153. will point to freed  memory, with  possible disastrous results, when a
  1154. new block is allocated.
  1155.  
  1156. The  memory  pointed  to by  "old_blk"    is not    freed  if it cannot be
  1157. re-allocated.
  1158.  
  1159. The _nrealloc function reallocates memory in the near heap.
  1160.  
  1161. In a small data memory    model, the _nrealloc function is equivalent to
  1162. the realloc function.
  1163.  
  1164. The  _nrealloc    function  is a    WATCOM    extension  to the  standard  C
  1165. library.
  1166. ::::_ROTL
  1167. #include \<stdlib.h>
  1168. unsigned int _rotl( unsigned int value,
  1169.             unsigned int shift );
  1170.  
  1171. The  _rotl  function  rotates  the  unsigned  integer,    determined  by
  1172. "value,"  to the left by the number of bits  specified    in "shift". If
  1173. you  port an  application  using  _rotl  between a 16-bit and a 32-bit
  1174. environment,  you will get different results because of the difference
  1175. in the size of integers.
  1176. ::::_ROTR
  1177. #include \<stdlib.h>
  1178. unsigned int _rotr( unsigned int value,
  1179.             unsigned int shift );
  1180.  
  1181. The  _rotr  function  rotates  the  unsigned  integer,    determined  by
  1182. "value,"  to the right by the number of bits  specified in "shift". If
  1183. you  port an  application  using  _rotr  between a 16-bit and a 32-bit
  1184. environment,  you will get different results because of the difference
  1185. in the size of integers.
  1186. ::::_SEARCHENV
  1187. #include \<stdlib.h>
  1188. void _searchenv( const char *name,
  1189.          const char *env_var,
  1190.          char *buffer );
  1191.  
  1192. The  _searchenv  function searches for the file specified by "name" in
  1193. the list of directories assigned to the environment variable specified
  1194. by "env_var". Common values for "env_var" are PATH, LIB and INCLUDE.
  1195.  
  1196. The current  directory is searched  first to find the  specified file.
  1197. If  the  file  is  not    found in the  current  directory,  each of the
  1198. directories specified by the environment variable is searched.
  1199.  
  1200. The full  pathname  is placed in the buffer pointed to by the argument
  1201. "buffer". If the  specified  file cannot be found, then  "buffer" will
  1202. contain an empty string.
  1203. ::::_SPLITPATH
  1204. #include \<stdlib.h>
  1205. void _splitpath( const char *path,
  1206.                char *drive,
  1207.                char *dir,
  1208.                char *fname,
  1209.                char *ext );
  1210.  
  1211. The _splitpath function splits up a full pathname into four components
  1212. consisting  of a drive letter, directory path, file name and file name
  1213. extension.  The argument "path" points to a buffer containing the full
  1214. pathname to be split up.
  1215.  
  1216. The maximum size required for each buffer is specified by the manifest
  1217. constants  _MAX_PATH,  _MAX_DRIVE,  _MAX_DIR, _MAX_FNAME, and _MAX_EXT
  1218. which are defined in \<stdlib.h>.
  1219.  
  1220. drive      The  "drive" argument points to a buffer that will be filled
  1221.       in with the drive letter (A, B, C, etc.) followed by a colon
  1222.       if a drive is specified in the full pathname.
  1223.  
  1224. dir      The "dir" argument points to a buffer that will be filled in
  1225.       with the  pathname  including  the trailing  slash.    Either
  1226.       forward slashes (/) or backslashes (\) may be used.
  1227.  
  1228. fname      The  "fname" argument points to a buffer that will be filled
  1229.       in  with the base  name of the file  without    any  extension
  1230.       (suffix).
  1231.  
  1232. ext      The "ext" argument points to a buffer that will be filled in
  1233.       with the filename  extension or suffix including the leading
  1234.       period.
  1235.  
  1236. The  arguments "drive," "dir," "fname" and "ext" will not be filled in
  1237. if they are NULL pointers.
  1238.  
  1239. For each  component  of the full  pathname  that is not  present,  its
  1240. corresponding buffer will be set to an empty string.
  1241. ::::_STATUS87
  1242. #include \<float.h>
  1243. unsigned int _status87( void );
  1244.  
  1245. The _status87 function returns the floating-point status word which is
  1246. used to  record  the status of    8087/80287/80387/80486    floating-point
  1247. operations.
  1248. ::::ABORT
  1249. #include \<stdlib.h>
  1250. void abort( void );
  1251.  
  1252. The abort function raises the signal SIGABRT.    The default action for
  1253. SIGABRT is to terminate  program  execution,  returning control to the
  1254. process  that  started    the  calling  program  (usually the  operating
  1255. system).   The    status    unsuccessful  termination  is  returned to the
  1256. invoking process by means of the function call raise(SIGABRT).     Under
  1257. DOS and OS/2, the status value is 3.
  1258. ::::ABS
  1259. #include \<stdlib.h>
  1260. int abs( int j );
  1261.  
  1262. The abs function  returns the absolute    value of its integer  argument
  1263. "j".
  1264. ::::ACCESS
  1265. #include \<io.h>
  1266. int access( const char *path, int mode );
  1267.  
  1268. The access  function  determines if the file or directory specified by
  1269. "path" exists and if it can be accessed with the file permission given
  1270. by "mode".
  1271.  
  1272. When the  value of  "mode"  is zero, only the existence of the file is
  1273. verified.   The  read  and/or  write  permission  for  the file can be
  1274. determined when "mode" is a combination of the bits:
  1275.  
  1276. R_OK        test for read permission
  1277.  
  1278. W_OK        test for write permission
  1279.  
  1280. X_OK        test for execute permission
  1281.  
  1282. F_OK        test for existence of file
  1283.  
  1284. With  DOS, all    files  have read permission; it is a good idea to test
  1285. for read  permission  anyway, since a later version of DOS may support
  1286. write-only files.
  1287. ::::ACOS
  1288. #include \<math.h>
  1289. double acos( double x );
  1290.  
  1291. The acos  function  computes the  principal  value of the arccosine of
  1292. "x". A domain error occurs for arguments not in the range [-1,1].
  1293. ::::ACOSH
  1294. #include \<math.h>
  1295. double acosh( double x );
  1296.  
  1297. The acosh  function  computes the inverse  hyperbolic cosine of "x". A
  1298. domain error occurs if the value of "x" is less than 1.0.
  1299. ::::ALLOCA
  1300. #include \<malloc.h>
  1301. void *alloca( size_t size );
  1302.  
  1303. The alloca function allocates space for an object of "size" bytes from
  1304. the stack.   The allocated  space is  automatically discarded when the
  1305. current function exits.   The alloca function should not be used in an
  1306. expression that is an argument to a function.
  1307. ::::ALLOCATION
  1308.               Memory Allocation Functions
  1309.               ═══════════════════════════
  1310.  
  1311. These  functions  allocate  and  de-allocate  blocks  of  memory.  The
  1312. following functions are defined:
  1313.  
  1314. <alloca>    allocate auto storage from stack
  1315. <calloc>    allocate and zero memory
  1316. <_expand>    expand a block of memory
  1317. <_fexpand>    expand    a  block  of  memory   (outside  default  data
  1318.         segment)
  1319. <_ffree>    free a block allocated using _fmalloc
  1320. <_fmalloc>    allocate a memory block (outside default data segment)
  1321. <_fmsize>    return the size of a memory block
  1322. <_frealloc>    re-allocate  a    memory    block  (outside  default  data
  1323.         segment)
  1324. <free>        free a block allocated using malloc, calloc or realloc
  1325. <_freect>    return number of objects that can be allocated
  1326. <halloc>    allocate huge array
  1327. <hfree>     free huge array
  1328. <malloc>    allocate a memory block (using current memory model)
  1329. <_memavl>    return amount of available memory
  1330. <_memmax>    return largest block of memory available
  1331. <_msize>    return the size of a memory block
  1332. <_nexpand>    expand a block of memory (inside default data segment)
  1333. <_nfree>    free a block allocated using _nmalloc
  1334. <_nmalloc>    allocate a memory block (inside default data segment)
  1335. <_nmsize>    return the size of a memory block
  1336. <_nrealloc>    re-allocate   a  memory  block    (inside  default  data
  1337.         segment)
  1338. <realloc>    re-allocate a block of memory
  1339. <sbrk>        set allocation "break" position
  1340. <stackavail>    determine available amount of stack space
  1341. ::::ASCTIME
  1342. #include \<time.h>
  1343. char *asctime( const struct tm *timeptr );
  1344.  
  1345. struct    tm {
  1346.   int tm_sec;    /* seconds after the minute -- [0,61] */
  1347.   int tm_min;    /* minutes after the hour   -- [0,59] */
  1348.   int tm_hour;    /* hours after midnight     -- [0,23] */
  1349.   int tm_mday;    /* day of the month        -- [1,31] */
  1350.   int tm_mon;    /* months since January     -- [0,11] */
  1351.   int tm_year;    /* years since 1900              */
  1352.   int tm_wday;    /* days since Sunday        -- [0,6]  */
  1353.   int tm_yday;    /* days since January 1     -- [0,365]*/
  1354.   int tm_isdst; /* Daylight Savings Time flag */
  1355. };
  1356.  
  1357. The asctime  function  converts the time  information in the structure
  1358. pointed  to  by  "timeptr"   into  a  string   containing  exactly  26
  1359. characters.  This string has the form shown in the following example:
  1360.  
  1361. Sat Mar 21 15:58:27 1987\n\0
  1362.  
  1363. All fields have a constant width.  The new-line character '\n' and the
  1364. null character '\0' occupy the last two positions of the string.
  1365.  
  1366. The area  containing  the returned string is re-used each time asctime
  1367. is called.
  1368. ::::ASIN
  1369. #include \<math.h>
  1370. double asin( double x );
  1371.  
  1372. The asin  function computes the principal value of the arcsine of "x".
  1373. A domain error occurs for arguments not in the range [-1,1].
  1374. ::::ASINH
  1375. #include \<math.h>
  1376. double asinh( double x );
  1377.  
  1378. The asinh function computes the inverse hyperbolic sine of "x".
  1379. ::::ASSERT
  1380. #include \<assert.h>
  1381. void assert( int expression );
  1382.  
  1383. The  assert macro prints a diagnostic  message upon the stderr    stream
  1384. and  terminates  the  program  if  "expression"  is  false (0).    The
  1385. diagnostic message has the form
  1386.  
  1387. Assertion failed:  "expression," file "filename," line "linenumber"
  1388.  
  1389. where  "filename"  is the name of the source  file and "linenumber" is
  1390. the  line  number of the  assertion  that  failed in the source  file.
  1391. "Filename" and "linenumber" are the values of the preprocessing macros
  1392. __FILE__   and     __LINE__   respectively.    No  action  is  taken  if
  1393. "expression" is true (non-zero).
  1394.  
  1395. The  assert  macro is typically  used during  program  development  to
  1396. identify  program  logic  errors.   The given  "expression"  should be
  1397. chosen so that it is true when the program is functioning as intended.
  1398. After the program has been debugged, the special "no debug" identifier
  1399. NDEBUG can be used to remove  assert calls from the program when it is
  1400. re-compiled.   If NDEBUG is defined (with any value) with a -d command
  1401. line option or with a #define  directive,  the C  preprocessor ignores
  1402. all assert calls in the program source.
  1403. ::::ATAN
  1404. #include \<math.h>
  1405. double atan( double x );
  1406.  
  1407. The atan  function  computes the  principal value of the arctangent of
  1408. "x".
  1409. ::::ATAN2
  1410. #include \<math.h>
  1411. double atan2( double y, double x );
  1412.  
  1413. The atan2  function  computes the principal value of the arctangent of
  1414. "y/x,"    using the signs of both arguments to determine the quadrant of
  1415. the return value.  A domain error occurs if both arguments are zero.
  1416. ::::ATANH
  1417. #include \<math.h>
  1418. double atanh( double x );
  1419.  
  1420. The atanh  function  computes the inverse hyperbolic tangent of "x". A
  1421. domain error occurs if the value of "x" is outside the range (-1,1).
  1422. ::::ATEXIT
  1423. #include \<stdlib.h>
  1424. int atexit( void (*func)(void) );
  1425.  
  1426. The atexit  function  is passed the  address of  function "func" to be
  1427. called    when the program  terminates  normally.   Successive  calls to
  1428. atexit create a list of functions that will be executed on a "last-in,
  1429. first-out"  basis.   No more than 32  functions can be registered with
  1430. the atexit function.
  1431.  
  1432. The functions have no parameters and do not return values.
  1433. ::::ATOF
  1434. #include \<stdlib.h>
  1435. double atof( const char *ptr );
  1436.  
  1437. The atof  function  converts  the string pointed to by "ptr" to double
  1438. representation.  It is equivalent to
  1439.  
  1440. strtod( ptr, (char **)NULL )
  1441. ::::ATOI
  1442. #include \<stdlib.h>
  1443. int atoi( const char *ptr );
  1444.  
  1445. The  atoi  function  converts  the  string  pointed to by "ptr" to int
  1446. representation.
  1447. ::::ATOL
  1448. #include \<stdlib.h>
  1449. long int atol( const char *ptr );
  1450.  
  1451. The atol  function converts the string pointed to by "ptr" to long int
  1452. representation.
  1453. ::::BDOS
  1454. #include \<dos.h>
  1455. int bdos( int dos_func, unsigned dx, unsigned char al );
  1456.  
  1457. The bdos  function causes the computer's central processor (CPU) to be
  1458. interrupted  with an interrupt number hexadecimal 21 ( 0x21), which is
  1459. a request to invoke a specific DOS  function.    Before the  interrupt,
  1460. the DX    register  is loaded  from "dx," the AH register is loaded with
  1461. the DOS  function number from "dos_func" and the AL register is loaded
  1462. from "al". The remaining registers are passed unchanged to DOS.
  1463.  
  1464. You should  consult the  technical documentation for the DOS operating
  1465. system    you  are  using to determine  the expected  register  contents
  1466. before and after the interrupt in question.
  1467. ::::BESSEL
  1468. #include \<math.h>
  1469. double j0( double x );
  1470. double j1( double x );
  1471. double jn( int n, double x );
  1472. double y0( double x );
  1473. double y1( double x );
  1474. double yn( int n, double x );
  1475.  
  1476. Functions j0, j1, and jn return Bessel functions of the first kind.
  1477.  
  1478. Functions  y0, y1, and yn return  Bessel functions of the second kind.
  1479. The argument "x" must be positive.   If "x" is negative, _matherr will
  1480. be  called  to print a DOMAIN  error  message to stderr,  set errno to
  1481. EDOM,  and  return the value  -HUGE_VAL.   This error  handling can be
  1482. modified by using the matherr routine.
  1483. ::::BIOS
  1484.                 BIOS Functions
  1485.                 ══════════════
  1486.  
  1487. This set of  functions allows access to services provided by the BIOS.
  1488. The following functions are defined:
  1489.  
  1490. <_bios_disk>        provide disk access functions
  1491. <_bios_equiplist>   determine equipment list
  1492. <_bios_keybrd>        provide low-level keyboard access
  1493. <_bios_memsize>     determine amount of system board memory
  1494. <_bios_printer>     provide access to printer services
  1495. <_bios_serialcom>   provide access to serial services
  1496. <_bios_timeofday>   get and set system clock
  1497. ::::BSEARCH
  1498. #include \<stdlib.h>
  1499. void *bsearch( const void *key,
  1500.            const void *base,
  1501.            size_t num,
  1502.            size_t width,
  1503.            int (*compar)( const void *pkey,
  1504.                   const void *pbase) );
  1505.  
  1506. The  bsearch  function    performs a binary  search of a sorted array of
  1507. "num"  elements,  which  is  pointed  to by "base,"  for an item which
  1508. matches  the object  pointed to by "key". Each element in the array is
  1509. "width" bytes in size.    The comparison function pointed to by "compar"
  1510. is called with two arguments that point to elements in the array.  The
  1511. first  argument  "pkey" points to the same object pointed to by "key".
  1512. The second  argument  "pbase"  points to a element in the array.   The
  1513. comparison  function  shall  return an integer less than, equal to, or
  1514. greater  than  zero if the  "key"  object  is less  than, equal to, or
  1515. greater than the element in the array.
  1516. ::::CABS
  1517. #include \<math.h>
  1518. double cabs( struct complex value );
  1519.  
  1520. struct complex {
  1521.     double real;    /* real part */
  1522.     double imag;    /* imaginary part */
  1523. };
  1524.  
  1525. The cabs  function  computes the absolute  value of the complex number
  1526. "value" by a calculation which is equivalent to
  1527.  
  1528. sqrt( (value.x * value.x) + (value.y * value.y) )
  1529.  
  1530. In  certain  cases,  overflow  errors  may  occur which will cause the
  1531. matherr routine to be invoked.
  1532. ::::CALLOC
  1533. #include \<stdlib.h>
  1534. void *calloc( size_t n, size_t size );
  1535.  
  1536. The calloc  function allocates space for an array of "n" objects, each
  1537. of length "size" bytes.  Each element is initialized to 0.
  1538.  
  1539. A block of memory  allocated using the calloc function should be freed
  1540. using the free function.
  1541. ::::CEIL
  1542. #include \<math.h>
  1543. double ceil( double x );
  1544.  
  1545. The ceil function (ceiling function) computes the smallest integer not
  1546. less than "x".
  1547. ::::CGETS
  1548. #include \<conio.h>
  1549. char *cgets( char *buf );
  1550.  
  1551. The  cgets  function  gets a string of    characters  directly  from the
  1552. console  and stores the string and its length in the array  pointed to
  1553. by "buf". The first  element of the array  "buf[0]"  must  contain the
  1554. maximum length in characters of the string to be read.    The array must
  1555. be big enough to hold the  string, a  terminating  null character, and
  1556. two additional bytes.
  1557.  
  1558. The cgets function reads  characters until a carriage-return line-feed
  1559. combination  is read, or until the  specified  number of characters is
  1560. read.    The string is stored in the array  starting  at  "buf[2]". The
  1561. carriage-return  line-feed combination, if read, is replaced by a null
  1562. character.    The  actual  length  of the  string  read  is  placed in
  1563. "buf[1]".
  1564. ::::CHARACTER
  1565.            Character Manipulation Functions
  1566.            ════════════════════════════════
  1567.  
  1568. These  functions  operate upon single  characters  of type char.   The
  1569. functions  test  characters  in  various ways and convert them between
  1570. upper and lower-case.  The following functions are defined:
  1571.  
  1572. <isalnum>    test for letter or digit
  1573. <isalpha>    test for letter
  1574. <isascii>    test for ASCII character
  1575. <iscntrl>    test for control character
  1576. <isdigit>    test for digit
  1577. <isgraph>    test for printable character, except space
  1578. <islower>    test for letter in lower-case
  1579. <isprint>    test for printable character, including space
  1580. <ispunct>    test for punctuation characters
  1581. <isspace>    test for "white space" characters
  1582. <isupper>    test for letter in upper-case
  1583. <isxdigit>    test for hexadecimal digit
  1584. <tolower>    convert character to lower-case
  1585. <toupper>    convert character to upper-case
  1586. ::::CHDIR
  1587. #include \<sys\types.h>
  1588. #include \<direct.h>
  1589. int chdir( const char *path );
  1590.  
  1591. The  chdir  function  changes  the  current  working  directory to the
  1592. specified  "path".  The "path" can be either  relative    to the current
  1593. working directory or it can be an absolute path name.
  1594. ::::CHMOD
  1595. #include \<sys\types.h>
  1596. #include \<sys\stat.h>
  1597. #include \<io.h>
  1598. int chmod( const char *path, int permission );
  1599.  
  1600. The chmod  function  changes the  permissions  for a file specified by
  1601. "path"    to be the  settings  in the  mode given by  "permission".  The
  1602. access    permissions  for  the file or  directory  are  specified  as a
  1603. combination of bits (defined in the \<sys\stat.h> header file).
  1604.  
  1605. The following bits define permissions for the owner.
  1606.  
  1607. S_IRWXU     Read, write, execute/search
  1608.  
  1609. S_IRUSR     Read permission
  1610.  
  1611. S_IWUSR     Write permission
  1612.  
  1613. S_IXUSR     Execute/search permission
  1614.  
  1615. The following bits define permissions for the group.
  1616.  
  1617. S_IRWXG     Read, write, execute/search
  1618.  
  1619. S_IRGRP     Read permission
  1620.  
  1621. S_IWGRP     Write permission
  1622.  
  1623. S_IXGRP     Execute/search permission
  1624.  
  1625. The following bits define permissions for others.
  1626.  
  1627. S_IRWXO     Read, write, execute/search
  1628.  
  1629. S_IROTH     Read permission
  1630.  
  1631. S_IWOTH     Write permission
  1632.  
  1633. S_IXOTH     Execute/search permission
  1634.  
  1635. The  following    bits define  miscellaneous  permissions  used by other
  1636. implementations.
  1637.  
  1638. S_IREAD     is equivalent to S_IRUSR (read permission)
  1639.  
  1640. S_IWRITE    is equivalent to S_IWUSR (write permission)
  1641.  
  1642. S_IEXEC     is equivalent to S_IXUSR (execute/search permission)
  1643.  
  1644. The following bits may also be specified in "permission".
  1645.  
  1646. S_ISUID     set user id on execution
  1647.  
  1648. S_ISGID     set group id on execution
  1649.  
  1650. If the calling    process does not have  appropriate  privileges, and if
  1651. the  group ID of the file does not match the effective group ID or one
  1652. of the supplementary group IDs, and if the file is a regular file, bit
  1653. S_ISGID  (set  group  ID on  execution)  in the  file's  mode shall be
  1654. cleared upon successful return from the chmod function.
  1655.  
  1656. Upon  successful  completion,  the chmod function will mark for update
  1657. the st_ctime field of the file.
  1658. ::::CHSIZE
  1659. #include \<io.h>
  1660. int chsize( int handle, long size );
  1661.  
  1662. The  chsize  function  changes    the size of the file  associated  with
  1663. "handle"  by  extending or truncating the file to the length specified
  1664. by "size". If the file needs to be  extended,  the file is padded with
  1665. NULL ('\0') characters.
  1666. ::::CLEARENV
  1667. #include \<env.h>
  1668. int clearenv( void );
  1669.  
  1670. The  clearenv  function  clears  the process  environment  area.    No
  1671. environment  variables    are  defined  immediately  after a call to the
  1672. clearenv  function.   Note that this clears the PATH,  COMSPEC, and TZ
  1673. environment  variables    which  may then affect the  operation of other
  1674. library functions.
  1675.  
  1676. The clearenv function may manipulate the value of the pointer environ.
  1677. ::::CLEARERR
  1678. #include \<stdio.h>
  1679. void clearerr( FILE *fp );
  1680.  
  1681. The clearerr  function clears the end-of-file and error indicators for
  1682. the stream  pointed to by "fp". These indicators are cleared only when
  1683. the file is  opened  or by an  explicit call to the clearerr or rewind
  1684. functions.
  1685. ::::CLOCK
  1686. #include \<time.h>
  1687. clock_t clock(void);
  1688.  
  1689. The clock function returns the number of clock ticks of processor time
  1690. used  by program  since the program  started  executing.   This can be
  1691. converted   to    seconds  by   dividing    by  the  value    of  the  macro
  1692. CLOCKS_PER_SEC.
  1693. ::::CLOSE
  1694. #include \<io.h>
  1695. int close( int handle );
  1696.  
  1697. The close function closes a file at the operating system level.    The
  1698. "handle"  value is the file  handle returned by a successful execution
  1699. of one of the creat, dup, dup2, open or sopen functions.
  1700. ::::CLOSEDIR
  1701. #include \<sys\types.h>
  1702. #include \<direct.h>
  1703. int closedir( DIR *dirp );
  1704.  
  1705. The  closedir  function  closes the directory  specified by "dirp" and
  1706. frees the memory allocated by opendir.
  1707. ::::CONSOLE
  1708.              Console I/O Functions
  1709.              ═════════════════════
  1710.  
  1711. These functions provide the capability to read and write data from the
  1712. console.    Data is read or written without any special initialization
  1713. (devices are not opened or closed), since the functions operate at the
  1714. hardware level.
  1715.  
  1716. The following functions are defined:
  1717.  
  1718. <cgets>     get a string from the console
  1719. <cprintf>    print formatted string to the console
  1720. <cputs>     write a string to the console
  1721. <cscanf>    scan formatted data from the console
  1722. <getch>     get character from console, no echo
  1723. <getche>    get character from console, echo it
  1724. <kbhit>     test if keystroke available
  1725. <putch>     write a character to the console
  1726. <ungetch>    push back next character from console
  1727. ::::CONVERSION
  1728.              Conversion Functions
  1729.              ════════════════════
  1730.  
  1731. These  functions  perform conversions between objects of various types
  1732. and strings.  The following functions are defined:
  1733.  
  1734. <atof>        string to double
  1735. <atoi>        string to int
  1736. <atol>        string to long int
  1737. <ecvt>        double to E-format string
  1738. <fcvt>        double to F-format string
  1739. <gcvt>        double to string
  1740. <itoa>        int to string
  1741. <ltoa>        long int to string
  1742. <strtod>    string to double
  1743. <strtol>    string to long int
  1744. <strtoul>    string to unsigned long int
  1745. <ultoa>     unsigned long int to string
  1746. <utoa>        unsigned int to string
  1747.  
  1748. See also <tolower>, <toupper>, <strlwr> and <strupr> which convert the
  1749. cases of characters and strings.
  1750. ::::COS
  1751. #include \<math.h>
  1752. double cos( double x );
  1753.  
  1754. The cos function computes the cosine of "x" (measured in radians).   A
  1755. large  magnitude  argument  may  yield    a  result  with  little  or no
  1756. significance.
  1757. ::::COSH
  1758. #include \<math.h>
  1759. double cosh( double x );
  1760.  
  1761. The cosh function computes the hyperbolic cosine of "x". A range error
  1762. occurs if the magnitude of "x" is too large.
  1763. ::::CPRINTF
  1764. #include \<conio.h>
  1765. int cprintf( const char *format, ... );
  1766.  
  1767. The  cprintf  function    writes    output    directly to the console  under
  1768. control of the argument "format". The putch function is used to output
  1769. characters to the console.  The "format" string is described under the
  1770. description for printf.
  1771. ::::CPUTS
  1772. #include \<conio.h>
  1773. int cputs( const char *buf );
  1774.  
  1775. The cputs  function  writes the  character  string pointed to by "buf"
  1776. directly  to the  console  using the putch function.   Unlike the puts
  1777. function,  the     carriage-return  and  line-feed  characters  are  not
  1778. appended  to the  string.    The  terminating  null  character    is not
  1779. written.
  1780. ::::CREAT
  1781. #include \<sys\types.h>
  1782. #include \<sys\stat.h>
  1783. #include \<io.h>
  1784. int creat( const char *path, int mode );
  1785.  
  1786. The creat  function creates (and opens) a file at the operating system
  1787. level.    It is equivalent to:
  1788.  
  1789.   open( path, O_WRONLY | O_CREAT | O_TRUNC, mode );
  1790.  
  1791. The name of the file to be  created  is given by "path". When the file
  1792. exists (it must be  writeable), it is truncated to contain no data and
  1793. the preceding "mode" setting is unchanged.
  1794.  
  1795. When the file does not exist, it is created  with  access  permissions
  1796. given by the "mode" argument.    The access permissions for the file or
  1797. directory  are    specified  as a  combination  of bits  (defined in the
  1798. \<sys\stat.h> header file).
  1799.  
  1800. The following bits define permissions for the owner.
  1801.  
  1802. S_IRWXU     Read, write, execute/search
  1803.  
  1804. S_IRUSR     Read permission
  1805.  
  1806. S_IWUSR     Write permission
  1807.  
  1808. S_IXUSR     Execute/search permission
  1809.  
  1810. The following bits define permissions for the group.
  1811.  
  1812. S_IRWXG     Read, write, execute/search
  1813.  
  1814. S_IRGRP     Read permission
  1815.  
  1816. S_IWGRP     Write permission
  1817.  
  1818. S_IXGRP     Execute/search permission
  1819.  
  1820. The following bits define permissions for others.
  1821.  
  1822. S_IRWXO     Read, write, execute/search
  1823.  
  1824. S_IROTH     Read permission
  1825.  
  1826. S_IWOTH     Write permission
  1827.  
  1828. S_IXOTH     Execute/search permission
  1829.  
  1830. The  following    bits define  miscellaneous  permissions  used by other
  1831. implementations.
  1832.  
  1833. S_IREAD     is equivalent to S_IRUSR (read permission)
  1834.  
  1835. S_IWRITE    is equivalent to S_IWUSR (write permission)
  1836.  
  1837. S_IEXEC     is equivalent to S_IXUSR (execute/search permission)
  1838.  
  1839. All  files  are  readable  with DOS; however, it is a good idea to set
  1840. S_IREAD when read permission is intended for the file.
  1841. ::::CSCANF
  1842. #include \<conio.h>
  1843. int cscanf( const char *format, ... );
  1844.  
  1845. The cscanf  function scans input from the console under control of the
  1846. argument  "format". Following the format string is a list of addresses
  1847. to receive  values.   The cscanf  function uses the function getche to
  1848. read  characters  from the console.   The "format" string is described
  1849. under the description of the scanf function.
  1850. ::::CTIME
  1851. #include \<time.h>
  1852. char *ctime( const time_t *timer );
  1853.  
  1854. The ctime function converts the calendar time pointed to by "timer" to
  1855. local time in the form of a string.  It is equivalent to
  1856.  
  1857. asctime( localtime( timer ) )
  1858.  
  1859. The ctime  function converts the time into a string containing exactly
  1860. 26  characters.   This    string    has  the  form shown in the  following
  1861. example:
  1862.  
  1863. Sat Mar 21 15:58:27 1987\n\0
  1864.  
  1865. All fields have a constant width.  The new-line character '\n' and the
  1866. null character '\0' occupy the last two positions of the string.
  1867.  
  1868. The area  containing the returned string is re-used each time ctime is
  1869. called.
  1870. ::::CWAIT
  1871. #include \<process.h>
  1872. int cwait( int *status, int process_id, int action );
  1873.  
  1874. The cwait  function  suspends the calling  process until the specified
  1875. child process terminates.
  1876.  
  1877. If  "status"  is not  NULL, it points to a word that will be filled in
  1878. with the  termination  status  word and return    code of the terminated
  1879. child process.
  1880.  
  1881. If the child  process  terminated normally, then the low order byte of
  1882. the status word will be set to 0, and the high order byte will contain
  1883. the low order byte of the return code that the child process passed to
  1884. the DOSEXIT  function.     The DOSEXIT  function is called whenever main
  1885. returns, or exit or _exit are explicity called.
  1886.  
  1887. If the child  process  did not terminate normally, then the high order
  1888. byte of the  status word will be set to 0, and the low order byte will
  1889. contain one of the following values:
  1890.  
  1891. 1    Hard-error abort
  1892.  
  1893. 2    Trap operation
  1894.  
  1895. 3    SIGTERM signal not intercepted
  1896.  
  1897. The  "process_id"  argument specifies which child process to wait for.
  1898. This value is  returned by the call to the spawn function that started
  1899. the child process.
  1900.  
  1901. The  "action"  argument  specifies  when the  parent  process  resumes
  1902. execution.  The possible values are:
  1903.  
  1904. WAIT_CHILD      Wait until the specified child process has ended.
  1905.  
  1906. WAIT_GRANDCHILD   Wait until the  specified  child  process and all of
  1907.           the  child  processes  of  that  child  process have
  1908.           ended.
  1909. ::::DELAY
  1910. #include \<dos.h>
  1911. void delay( unsigned milliseconds );
  1912.  
  1913. The  delay  function  suspends    execution by the  specified  number of
  1914. "milliseconds".
  1915. ::::DIFFTIME
  1916. #include \<time.h>
  1917. double difftime( time_t time1, time_t time0 )
  1918.  
  1919. The  difftime  function  calculates  the  difference  between  the two
  1920. calendar times:
  1921.  
  1922.     time1 - time0
  1923. ::::DIRECTORY
  1924.               Directory Functions
  1925.               ═══════════════════
  1926.  
  1927. These  functions  pertain  to directory  manipulation.     The following
  1928. functions are defined:
  1929.  
  1930. <chdir>     change current working directory
  1931. <closedir>    close opened directory file
  1932. <getcwd>    get current working directory
  1933. <mkdir>     make a new directory
  1934. <opendir>    open directory file
  1935. <readdir>    read file name from directory
  1936. <rmdir>     remove a directory
  1937. ::::DIV
  1938. #include \<stdlib.h>
  1939. div_t div( int numer, int denom );
  1940.  
  1941. typedef struct {
  1942.     int quot;      /* quotient */
  1943.     int rem;      /* remainder */
  1944. } div_t;
  1945.  
  1946. The div function calculates the quotient and remainder of the division
  1947. of the numerator "numer" by the denominator "denom".
  1948. ::::DOS
  1949.             DOS-Specific Functions
  1950.             ══════════════════════
  1951.  
  1952. These  functions  provide  the    capability  to    invoke    DOS  functions
  1953. directly from a program.  The following functions are defined:
  1954.  
  1955. <bdos>            DOS call (short form)
  1956. <dosexterr>        extract DOS error information
  1957. <_dos_allocmem>     allocate a block of memory
  1958. <_dos_close>        close a file
  1959. <_dos_creat>        create a file
  1960. <_dos_creatnew>     create a new file
  1961. <_dos_findfirst>    find first file matching a specified pattern
  1962. <_dos_findnext>     find the next file matching a specified pattern
  1963. <_dos_freemem>        free a block of memory
  1964. <_dos_getdate>        get current system date
  1965. <_dos_getdiskfree>  get information about disk
  1966. <_dos_getdrive>     get the current drive
  1967. <_dos_getfileattr>  get file attributes
  1968. <_dos_getftime>     get file's last modification time
  1969. <_dos_gettime>        get the current system time
  1970. <_dos_getvect>        get contents of interrupt vector
  1971. <_dos_keep>        install a terminate-and-stay-resident program
  1972. <_dos_open>        open a file
  1973. <_dos_read>        read data from a file
  1974. <_dos_setblock>     change the size of allocated block
  1975. <_dos_setdate>        change current system date
  1976. <_dos_setdrive>     change the current default drive
  1977. <_dos_setfileattr>  set the attributes of a file
  1978. <_dos_setftime>     set a file's last modification time
  1979. <_dos_settime>        set the current system time
  1980. <_dos_setvect>        set an interrupt vector
  1981. <_dos_write>        write data to a file
  1982. <intdos>        cause DOS interrupt
  1983. <intdosx>        cause DOS interrupt, with segment registers
  1984. ::::DOSEXTERR
  1985. #include \<dos.h>
  1986. int dosexterr( struct DOSERROR *err_info );
  1987.  
  1988. struct DOSERROR {
  1989.     int exterror;    /* contents of AX register */
  1990.     char class;    /* contents of BH register */
  1991.     char action;    /* contents of BL register */
  1992.     char locus;    /* contents of CH register */
  1993. };
  1994.  
  1995. The dosexterr function extracts extended error information following a
  1996. failed DOS  function.    This  information  is placed in the  structure
  1997. located by  "err_info".  This function is only useful with DOS version
  1998. 3.0 or later.
  1999.  
  2000. You should  consult the  technical documentation for the DOS system on
  2001. your computer for an interpretation of the error information.
  2002. ::::DUP
  2003. #include \<io.h>
  2004. int dup( int handle );
  2005.  
  2006. The dup  function  duplicates  the file  handle  given by the argument
  2007. "handle".  The new file  handle refers to the same open file handle as
  2008. the original file handle, and shares any locks.    The new file handle
  2009. is  identical  to the  original in that it references the same file or
  2010. device, it has the same open mode (read and/or write) and it will have
  2011. file position identical to the original.    Changing the position with
  2012. one handle will result in a changed position in the other.
  2013. ::::DUP2
  2014. #include \<io.h>
  2015. int dup2( int handle, int handle2 );
  2016.  
  2017. The  dup2  function  duplicates  the file handle given by the argument
  2018. "handle".  The new file handle is identical to the original in that it
  2019. references  the same  file or  device, it has the same open mode (read
  2020. and/or write) and it will have identical file position to the original
  2021. (changing  the    position  with    one  handle  will  result in a changed
  2022. position in the other).
  2023.  
  2024. The number of the new handle is "handle2". If a file already is opened
  2025. with  this  handle,  the  file    is closed  before the  duplication  is
  2026. attempted.
  2027. ::::ECVT
  2028. #include \<stdlib.h>
  2029. char *ecvt( double value,
  2030.         int ndigits,
  2031.         int *dec,
  2032.         int *sign );
  2033.  
  2034. The ecvt function  converts the  floating-point  number "value" into a
  2035. character  string.   The parameter  "ndigits"  specifies the number of
  2036. significant digits desired.    The converted number will be rounded to
  2037. "ndigits" of precision.
  2038.  
  2039. The  character    string will contain only digits and is terminated by a
  2040. null  character.   The    integer  pointed to by "dec" will be filled in
  2041. with a value  indicating the position of the decimal point relative to
  2042. the start of the string of digits.  A zero or negative value indicates
  2043. that the  decimal  point  lies to the left of the  first  digit.   The
  2044. integer pointed to by "sign" will contain 0 if the number is positive,
  2045. and non-zero if the number is negative.
  2046. ::::ENVIRONMENT
  2047.               Process Environment
  2048.               ═══════════════════
  2049.  
  2050. These  functions  deal    with process  identification,  process groups,
  2051. system     identification,   system  time,  environment  variables,  and
  2052. terminal identification.  The following functions are defined:
  2053.  
  2054. <clearenv>    delete environment variables
  2055. <getcmd>    get command line
  2056. <getpid>    return process ID of calling process
  2057. <getenv>    get environment variable value
  2058. <isatty>    determine  if  file   descriptor   associated  with  a
  2059.         terminal
  2060. <putenv>    add, change or delete environment variable
  2061. <_searchenv>    search for a file in list of directories
  2062. <setenv>    add, change or delete environment variable
  2063. <time>        get current calendar time
  2064. ::::EOF
  2065. #include \<io.h>
  2066. int eof( int handle );
  2067.  
  2068. The eof function determines, at the operating system level, if the end
  2069. of the file has been  reached  for the file whose file handle is given
  2070. by  "handle".  Because the current file  position is set  following an
  2071. input  operation,  the eof function may be called to detect the end of
  2072. the  file  before  an  input  operation  beyond the end of the file is
  2073. attempted.
  2074. ::::EXEC
  2075. #include \<process.h>
  2076. int execl(   path, arg0, arg1..., argn, NULL );
  2077. int execle(  path, arg0, arg1..., argn, NULL, envp );
  2078. int execlp(  file, arg0, arg1..., argn, NULL );
  2079. int execlpe( file, arg0, arg1..., argn, NULL, envp );
  2080. int execv(   path, argv );
  2081. int execve(  path, argv, envp );
  2082. int execvp(  file, argv );
  2083. int execvpe( file, argv, envp );
  2084.   const char *path;        /* file name incl. path */
  2085.   const char *file;        /* file name        */
  2086.   const char *arg0, ..., *argn; /* arguments        */
  2087.   char *const argv[];        /* array of arguments    */
  2088.   char *const envp[];        /* environment strings    */
  2089.  
  2090. The exec  functions  load and  execute a new child  process,  named by
  2091. "path"    or  "file". If the child  process is  successfully  loaded, it
  2092. replaces  the  current    process  in memory.   No return is made to the
  2093. original program.
  2094.  
  2095. The program is located by using the following logic in sequence:
  2096.  
  2097.    1. An attempt is made to locate the    program in the current working
  2098.       directory  if no    directory  specification  precedes the program
  2099.       name; otherwise, an attempt is made in the specified directory.
  2100.  
  2101.    2. If no file  extension  is  given, an attempt is made to find the
  2102.       program  name, in the  directory    indicated  in the first point,
  2103.       with .COM concatenated to the end of the program name.
  2104.  
  2105.    3. If no file  extension  is  given, an attempt is made to find the
  2106.       program  name, in the  directory    indicated  in the first point,
  2107.       with .EXE concatenated to the end of the program name.
  2108.  
  2109.    4. When no  directory specification is given as part of the program
  2110.       name, the execlp,  execlpe,  execvp, and execvpe    functions will
  2111.       repeat the  preceding  three  steps for each of the  directories
  2112.       specified by the PATH environment variable.  The command
  2113.  
  2114.       path c:\myapps;d:\lib\applns
  2115.  
  2116.       indicates that the two directories
  2117.  
  2118.       c:\myapps
  2119.       d:\lib\applns
  2120.  
  2121.       are to be searched.  The DOS path command (without any directory
  2122.       specification)  will  cause  the current path  definition  to be
  2123.       displayed.
  2124.  
  2125. An error is detected when the program cannot be found.
  2126.  
  2127. Arguments  are passed to the child  process by    supplying  one or more
  2128. pointers  to  character strings as arguments in the exec call.     These
  2129. character  strings are    concatenated  with spaces inserted to separate
  2130. the arguments to form one argument string for the child process.   The
  2131. length of this    concatenated  string must not exceed 128 bytes in real
  2132. mode.
  2133.  
  2134. The  arguments    may be passed as a list of  arguments  (execl, execle,
  2135. execlp,  and  execlpe)    or as a  vector of  pointers  (execv,  execve,
  2136. execvp, and  execvpe).     At least one  argument,  "arg0" or "argv[0]",
  2137. must  be  passed  to the child    process.   By  convention,  this first
  2138. argument is a pointer to the name of the program.
  2139.  
  2140. If the arguments are passed as a list, there must be a NULL pointer to
  2141. mark  the end of the  argument    list.    Similarly,  if a pointer to an
  2142. argument vector is passed, the argument vector must be terminated by a
  2143. NULL pointer.
  2144.  
  2145. The  environment  for the invoked program is inherited from the parent
  2146. process  when you use the execl,  execlp, execv, and execvp functions.
  2147. The execle,  execlpe,  execve, and execvpe functions allow a different
  2148. environment  to be  passed  to the child  process  through  the "envp"
  2149. argument.    The argument "envp" is a pointer to an array of character
  2150. pointers,  each of which  points to a string  defining    an environment
  2151. variable.   The array is terminated with a NULL pointer.  Each pointer
  2152. locates a character string of the form
  2153.  
  2154.     variable=value
  2155.  
  2156. that  is  used    to define an  environment  variable.   If the value of
  2157. "envp" is NULL, then the child process inherits the environment of the
  2158. parent process.
  2159.  
  2160. The  environment  is the  collection  of environment  variables  whose
  2161. values have been defined with the DOS SET command or by the successful
  2162. execution  of the putenv  function.   A program  may read these values
  2163. with the getenv function.
  2164.  
  2165. The execvpe and execlpe functions are extensions to POSIX 1003.1.
  2166. ::::EXECL
  2167.  ->EXEC
  2168. ::::EXECLE
  2169.  ->EXEC
  2170. ::::EXECLP
  2171.  ->EXEC
  2172. ::::EXECLPE
  2173.  ->EXEC
  2174. ::::EXECV
  2175.  ->EXEC
  2176. ::::EXECVE
  2177.  ->EXEC
  2178. ::::EXECVP
  2179.  ->EXEC
  2180. ::::EXECVPE
  2181.  ->EXEC
  2182. ::::EXIT
  2183. #include \<stdlib.h>
  2184. void exit( int status );
  2185.  
  2186. The exit function causes normal program termination to occur.
  2187.  
  2188. First, all  functions  registered by the atexit function are called in
  2189. the  reverse  order of their  registration.   Next, all open files are
  2190. flushed  and closed, and all files created by the tmpfile function are
  2191. removed.  Finally, the low-order byte of "status" is made available to
  2192. the parent  process.   The  "status"  value is    typically  set to 0 to
  2193. indicate  successful  termination  and    set to    some  other  value  to
  2194. indicate an error.
  2195. ::::EXP
  2196. #include \<math.h>
  2197. double exp( double x );
  2198.  
  2199. The  exp function  computes the  exponential  function of "x". A range
  2200. error occurs if the magnitude of "x" is too large.
  2201. ::::FABS
  2202. #include \<math.h>
  2203. double fabs( double x );
  2204.  
  2205. The fabs function computes the absolute value of the argument "x".
  2206. ::::FCLOSE
  2207. #include \<stdio.h>
  2208. int fclose( FILE *fp );
  2209.  
  2210. The fclose  function  closes the file "fp". If there was any unwritten
  2211. buffered  data for the    file, it is  written  out  before  the file is
  2212. closed.   Any unread  buffered    data is discarded.   If the associated
  2213. buffer was automatically allocated, it is deallocated.
  2214. ::::FCLOSEALL
  2215. #include \<stdio.h>
  2216. int fcloseall( void );
  2217.  
  2218. The  fcloseall    function  closes all open stream  files, except stdin,
  2219. stdout,  stderr,  stdaux, and stdprn.    This includes  streams created
  2220. (and not yet closed) by fdopen, fopen and freopen.
  2221. ::::FCVT
  2222. #include \<stdlib.h>
  2223. char *fcvt( double value,
  2224.         int ndigits,
  2225.         int *dec,
  2226.         int *sign );
  2227.  
  2228. The fcvt function  converts the  floating-point  number "value" into a
  2229. character  string.   The parameter  "ndigits"  specifies the number of
  2230. digits desired after the decimal point.   The converted number will be
  2231. rounded to this position.
  2232.  
  2233. The  character    string will contain only digits and is terminated by a
  2234. null  character.   The    integer  pointed to by "dec" will be filled in
  2235. with a value  indicating the position of the decimal point relative to
  2236. the start of the string of digits.  A zero or negative value indicates
  2237. that the  decimal  point  lies to the left of the  first  digit.   The
  2238. integer pointed to by "sign" will contain 0 if the number is positive,
  2239. and non-zero if the number is negative.
  2240. ::::FDOPEN
  2241. #include \<stdio.h>
  2242. FILE *fdopen( int handle, const char *mode );
  2243.  
  2244. The fdopen  function associates a stream with the file handle "handle"
  2245. which represents an opened file or device.  The handle was returned by
  2246. one of creat, dup, dup2 or open.   The open mode "mode" must match the
  2247. mode with which the file or device was originally opened.
  2248.  
  2249. The  argument  "mode"  is  described in the  description  of the fopen
  2250. function.
  2251. ::::FEOF
  2252. #include \<stdio.h>
  2253. int feof( FILE *fp );
  2254.  
  2255. The  feof  function  tests the    end-of-file  indicator    for the stream
  2256. pointed  to by    "fp".  Because    this  indicator  is set  when an input
  2257. operation  attempts to read past the end of the file the feof function
  2258. will  detect the end of the file only after an attempt is made to read
  2259. beyond    the end of the    file.    Thus, if a file contains 10 lines, the
  2260. feof will not detect end of file after the tenth line is read; it will
  2261. detect end of file once the program attempts to read more data.
  2262. ::::FERROR
  2263. #include \<stdio.h>
  2264. int ferror( FILE *fp );
  2265.  
  2266. The ferror  function  tests the error indicator for the stream pointed
  2267. to by "fp".
  2268. ::::FFLUSH
  2269. #include \<stdio.h>
  2270. int fflush( FILE *fp );
  2271.  
  2272. If the    file  "fp" is open for output or update,  the fflush  function
  2273. causes any unwritten data to be written to the file.  If the file "fp"
  2274. is open for input or update,  the fflush function undoes the effect of
  2275. any preceding ungetc operation on the stream.  If the value of "fp" is
  2276. NULL, then all files that are open will be flushed.
  2277. ::::FGETC
  2278. #include \<stdio.h>
  2279. int fgetc( FILE *fp );
  2280.  
  2281. The fgetc function gets the next character from the file designated by
  2282. "fp". The character is signed.
  2283. ::::FGETCHAR
  2284. #include \<stdio.h>
  2285. int fgetchar( void );
  2286.  
  2287. The fgetchar function is equivalent to fgetc with the argument stdin.
  2288. ::::FGETPOS
  2289. #include \<stdio.h>
  2290. int fgetpos( FILE *fp, fpos_t *pos );
  2291.  
  2292. The  fgetpos  function stores the current position of the file "fp" in
  2293. the  object  pointed  to by  "pos". The value  stored is usable by the
  2294. fsetpos  function  for    repositioning  the file to its position at the
  2295. time of the call to the fgetpos function.
  2296. ::::FGETS
  2297. #include \<stdio.h>
  2298. char *fgets( char *buf, size_t n, FILE *fp );
  2299.  
  2300. The  fgets  function  gets  a  string  of  characters  from  the  file
  2301. designated  by "fp" and stores    them in the array pointed to by "buf".
  2302. The  fgets  function  stops  reading  characters  when    end-of-file is
  2303. reached, or when a newline character is read, or when "n-1" characters
  2304. have been read, whichever comes first.     The new-line character is not
  2305. discarded.   A null  character    is placed  immediately    after the last
  2306. character read into the array.
  2307.  
  2308. The gets is similar to fgets  except  that it  operates with stdin, it
  2309. has no size argument and it replaces a newline character with the null
  2310. character.
  2311. ::::FILE
  2312.               File Manipulation Functions
  2313.               ═══════════════════════════
  2314.  
  2315. These functions operate directly with files.   The following functions
  2316. are defined:
  2317.  
  2318. <access>    test file or directory for mode of access
  2319. <chmod>     change permissions for a file
  2320. <remove>    delete a file
  2321. <rename>    rename a file
  2322. <stat>        get file status
  2323. <tmpnam>    create name for temporary file
  2324. <utime>     set modification time for a file
  2325. ::::FILELENGTH
  2326. #include \<io.h>
  2327. long int filelength( int handle );
  2328.  
  2329. The filelength function returns the number of bytes in the opened file
  2330. indicated by the file handle "handle".
  2331. ::::FILENO
  2332. #include \<stdio.h>
  2333. int fileno( FILE *stream );
  2334.  
  2335. The fileno function returns the number of the file handle for the file
  2336. designated by "stream".
  2337. ::::FLOOR
  2338. #include \<math.h>
  2339. double floor( double x );
  2340.  
  2341. The floor function computes the largest integer not greater than "x".
  2342. ::::FLUSHALL
  2343. #include \<stdio.h>
  2344. int flushall( void );
  2345.  
  2346. The flushall function clears all buffers associated with input streams
  2347. and writes any buffers associated with output streams.      A subsequent
  2348. read  operation  on an input  file causes new data to be read from the
  2349. associated file or device.
  2350.  
  2351. The  function  is equivalent to calling the fflush for all open stream
  2352. files.
  2353. ::::FMOD
  2354. #include \<math.h>
  2355. double fmod( double x, double y );
  2356.  
  2357. The fmod function computes the floating-point remainder of "x/y," even
  2358. if the quotient "x/y" is not representable.
  2359. ::::FOPEN
  2360. #include \<stdio.h>
  2361. FILE *fopen( const char *filename, const char *mode );
  2362.  
  2363. The fopen  function opens the file whose name is the string pointed to
  2364. by "filename," and associates a stream with it.    The argument "mode"
  2365. points to a string beginning with one of the following sequences:
  2366.  
  2367. "r"   open file for reading; use default file translation
  2368.  
  2369. "w"   create file for writing, or truncate to zero length; use default
  2370.       file translation
  2371.  
  2372. "a"   append:    open text file or create for  writing at  end-of-file;
  2373.       use default file translation
  2374.  
  2375. "rb"  open binary file for reading
  2376.  
  2377. "rt"  open text file for reading
  2378.  
  2379. "wb"  create binary file for writing, or truncate to zero length
  2380.  
  2381. "wt"  create text file for writing, or truncate to zero length
  2382.  
  2383. "ab"  append; open binary file or create for writing at end-of-file
  2384.  
  2385. "at"  append; open text file or create for writing at end-of-file
  2386.  
  2387. "r+"  open file for update  (reading and/or writing); use default file
  2388.       translation
  2389.  
  2390. "w+"  create  file for update, or truncate to zero length; use default
  2391.       file translation
  2392.  
  2393. "a+"  append;  open file or create for update, writing at end-of-file;
  2394.       use default file translation
  2395.  
  2396. "r+b" open binary file for update (reading and/or writing)
  2397.  
  2398. "r+t" open text file for update (reading and/or writing)
  2399.  
  2400. "w+b" create binary file for update, or truncate to zero length
  2401.  
  2402. "w+t" create text file for update, or truncate to zero length
  2403.  
  2404. "a+b" append;  open  binary  file  or  create for  update,  writing at
  2405.       end-of-file
  2406.  
  2407. "a+t" append;  open  text  file  or  create  for  update,  writing  at
  2408.       end-of-file
  2409.  
  2410. "rb+" open binary file for update (reading and/or writing)
  2411.  
  2412. "rt+" open text file for update (reading and/or writing)
  2413.  
  2414. "wb+" create binary file for update, or truncate to zero length
  2415.  
  2416. "wt+" create text file for update, or truncate to zero length
  2417.  
  2418. "ab+" append;  open  binary  file  or  create for  update,  writing at
  2419.       end-of-file
  2420.  
  2421. "at+" append;  open  text  file  or  create  for  update,  writing  at
  2422.       end-of-file
  2423.  
  2424. When default file  translation    is  specified, the value of the global
  2425. variable _fmode establishes whether the file is to treated as a binary
  2426. or a text  file.   Unless  this value is changed by the  program,  the
  2427. default will be text mode.
  2428.  
  2429. Opening  a file  with  read  mode ( 'r' as the    first character in the
  2430. "mode"    argument)  fails  if the  file    does not exist or it cannot be
  2431. read.  Opening a file with append mode ( 'a' as the first character in
  2432. the "mode"  argument)  causes all  subsequent writes to the file to be
  2433. forced to the current end-of-file, regardless of previous calls to the
  2434. fseek function.    When a file is opened with update mode ( '+' as the
  2435. second    or  third  character of the "mode"  argument),    both input and
  2436. output may be performed on the associated stream.
  2437. ::::FP_OFF
  2438. #include \<dos.h>
  2439. unsigned FP_OFF( void __far *far_ptr );
  2440.  
  2441. The FP_OFF  macro can be used to obtain the offset  portion of the far
  2442. pointer value given in "far_ptr".
  2443. ::::FP_SEG
  2444. #include \<dos.h>
  2445. unsigned FP_SEG( void __far *far_ptr );
  2446.  
  2447. The FP_SEG  macro can be used to obtain the segment portion of the far
  2448. pointer value given in "far_ptr".
  2449. ::::FPRINTF
  2450. #include \<stdio.h>
  2451. int fprintf( FILE *fp, const char *format, ... );
  2452.  
  2453. The  fprintf  function    writes    output to the file  pointed to by "fp"
  2454. under  control    of the    argument  "format".  The  "format"  string  is
  2455. described under the description of the printf function.
  2456. ::::FPUTC
  2457. #include \<stdio.h>
  2458. int fputc( int c, FILE *fp );
  2459.  
  2460. The fputc  function writes the character specified by the argument "c"
  2461. to the output stream designated by "fp".
  2462. ::::FPUTCHAR
  2463. #include \<stdio.h>
  2464. int fputchar( int c );
  2465.  
  2466. The fputchar  function    writes the character specified by the argument
  2467. "c" to the output stream stdout.
  2468.  
  2469. The function is equivalent to:
  2470.  
  2471.     fputc( c, stdout );
  2472. ::::FPUTS
  2473. #include \<stdio.h>
  2474. int fputs( const char *buf, FILE *fp );
  2475.  
  2476. The fputs  function writes the character string pointed to by "buf" to
  2477. the output  stream  designated by "fp". The terminating null character
  2478. is not written.
  2479. ::::FREAD
  2480. #include \<stdio.h>
  2481. size_t fread( void *buf,
  2482.           size_t elsize,
  2483.           size_t nelem,
  2484.           FILE *fp );
  2485.  
  2486. The fread  function reads "nelem" elements of "elsize" bytes each from
  2487. the file specified by "fp" into the buffer specified by "buf".
  2488. ::::FREE
  2489. #include \<stdlib.h>
  2490. void free( void *ptr );
  2491.  
  2492. When the value of the  argument  "ptr" is NULL, the free function does
  2493. nothing  otherwise,  the free  function  deallocates  the memory block
  2494. located  by  the  argument  "ptr"  which  points  to  a  memory  block
  2495. previously  allocated  through    a call    to calloc,  malloc or realloc.
  2496. After the call, the freed block is available for allocation.
  2497.  
  2498. In a large data  memory  model, the free function is equivalent to the
  2499. _ffree    function;  in a small data  memory model, the free function is
  2500. equivalent to the _nfree function.
  2501. ::::FREOPEN
  2502. #include \<stdio.h>
  2503. FILE *freopen( const char *filename,
  2504.            const char *mode,
  2505.            FILE *fp );
  2506.  
  2507. The stream located by the fp pointer is closed.   The freopen function
  2508. opens the file whose name is the string  pointed to by "filename," and
  2509. associates a stream with it.   The stream information is placed in the
  2510. structure located by the "fp" pointer.
  2511.  
  2512. The  argument  "mode"  is  described in the  description  of the fopen
  2513. function.
  2514. ::::FREXP
  2515. #include \<math.h>
  2516. double frexp( double value, int *exp );
  2517.  
  2518. The frexp  function  breaks a  floating-point number into a normalized
  2519. fraction and an integral power of 2.   It stores the integral power of
  2520. 2 in the "int" object pointed to by "exp".
  2521. ::::FSCANF
  2522. #include \<stdio.h>
  2523. int fscanf( FILE *fp, const char *format, ... );
  2524.  
  2525. The fscanf function scans input from the file designated by "fp" under
  2526. control of the argument  "format".  Following  the format  string is a
  2527. list of addresses to receive values.  The "format" string is described
  2528. under the description of the scanf function.
  2529. ::::FSEEK
  2530. #include \<stdio.h>
  2531. int fseek( FILE *fp, long int offset, int where );
  2532.  
  2533. The  fseek  function  changes  the  read/write    position  of the  file
  2534. specified by "fp". This  position  defines the    character that will be
  2535. read or written on the next I/O operation on the file.      The argument
  2536. "fp" is a file    pointer  returned  by fopen or freopen.   The argument
  2537. "offset" is the position to seek to relative to one of three positions
  2538. specified by the argument "where". Allowable values for "where" are:
  2539.  
  2540. SEEK_SET       The new file position is computed relative to the start
  2541.            of  the    file.     The  value  of  "offset"  must not be
  2542.            negative.
  2543.  
  2544. SEEK_CUR       The  new file  position    is  computed  relative    to the
  2545.            current    file  position.   The value of "offset" may be
  2546.            positive, negative or zero.
  2547.  
  2548. SEEK_END       The new file  position  is computed relative to the end
  2549.            of the file.
  2550.  
  2551. The  fseek function  clears the  end-of-file  indicator and undoes any
  2552. effects of the ungetc function on the same file.
  2553.  
  2554. The ftell  function  can be used to obtain the current position in the
  2555. file  before  changing it.   The position can be restored by using the
  2556. value returned by ftell in a subsequent call to fseek with the "where"
  2557. parameter set to SEEK_SET.
  2558. ::::FSETPOS
  2559. #include \<stdio.h>
  2560. int fsetpos( FILE *fp, fpos_t *pos );
  2561.  
  2562. The fsetpos function positions the file "fp" according to the value of
  2563. the object  pointed to by "pos," which shall be a value returned by an
  2564. earlier call to the fgetpos function on the same file.
  2565. ::::FSTAT
  2566. #include \<sys\types.h>
  2567. #include \<sys\stat.h>
  2568. int fstat( int handle, struct stat *buf );
  2569.  
  2570. The fstat  function  obtains information about an open file whose file
  2571. handle    is  "handle".  This  information  is  placed in the  structure
  2572. located at the address indicated by "buf".
  2573.  
  2574. The file \<sys\stat.h> contains definitions for the structure stat.
  2575.  
  2576. struct stat {
  2577.    dev_t   st_dev;    /* disk drive file resides on */
  2578.    ino_t   st_ino;    /* this inode's number        */
  2579.    unsigned short st_mode; /* file mode         */
  2580.    short   st_nlink;  /* # of hard links        */
  2581.    short   st_uid;    /* user-id, always 'root'     */
  2582.    short   st_gid;    /* group-id, always 'root'    */
  2583.    dev_t   st_rdev;   /* drive #, same as st_dev    */
  2584.    off_t   st_size;   /* total file size        */
  2585.    time_t  st_atime;  /* time of last access        */
  2586.    time_t  st_mtime;  /* time of last modification  */
  2587.    time_t  st_ctime;  /* time of last status change */
  2588. };
  2589.  
  2590. ::::FTELL
  2591. #include \<stdio.h>
  2592. long int ftell( FILE *fp );
  2593.  
  2594. The ftell function returns the current read/write position of the file
  2595. specified by "fp". This  position  defines the    character that will be
  2596. read or  written  by the next I/O  operation  on the file.   The value
  2597. returned by ftell can be used in a subsequent call to fseek to set the
  2598. file to the same position.
  2599. ::::FTIME
  2600. #include \<sys\timeb.h>
  2601. void ftime( struct timeb *timeptr );
  2602.  
  2603. struct timeb {
  2604.  time_t time;  /* time in seconds since Jan 1, 1970 UTC */
  2605.  unsigned short millitm; /* milliseconds */
  2606.  short timezone; /* difference in minutes from UTC */
  2607.  short dstflag;  /* nonzero if in daylight savings time */
  2608. };
  2609.  
  2610. The  ftime  function  gets  the  current  time    and  stores  it in the
  2611. structure pointed to by "timeptr".
  2612. ::::FWRITE
  2613. #include \<stdio.h>
  2614. size_t fwrite( const void *buf,
  2615.            size_t elsize,
  2616.            size_t nelem,
  2617.            FILE *fp );
  2618.  
  2619. The fwrite  function writes "nelem" elements of "elsize" bytes each to
  2620. the file specified by "fp".
  2621. ::::GCVT
  2622. #include \<stdlib.h>
  2623. char *gcvt( double value,
  2624.         int ndigits,
  2625.         char *buffer );
  2626.  
  2627. The gcvt function  converts the  floating-point  number "value" into a
  2628. character  string  and    stores the result in "buffer".    The  parameter
  2629. "ndigits"  specifies the number of significant    digits    desired.   The
  2630. converted number will be rounded to this position.
  2631.  
  2632. If the    exponent  of the  number is less than -4 or is greater than or
  2633. equal to the number of    significant  digits wanted, then the number is
  2634. converted  into  E-format,  otherwise  the  number is formatted  using
  2635. F-format.
  2636. ::::GETC
  2637. #include \<stdio.h>
  2638. int getc( FILE *fp );
  2639.  
  2640. The getc  function gets the next character from the file designated by
  2641. "fp". The character is returned as an int value.  The getc function is
  2642. equivalent to fgetc, except that it may be implemented as a macro.
  2643. ::::GETCH
  2644. #include \<conio.h>
  2645. int getch( void );
  2646.  
  2647. The  getch  function  obtains the next    available  keystroke  from the
  2648. console.   Nothing is echoed on the screen (the  function  getche will
  2649. echo the keystroke, if possible).  When no keystroke is available, the
  2650. function waits until a key is depressed.
  2651.  
  2652. The  kbhit  function  can be  used  to    determine  if a  keystroke  is
  2653. available.
  2654. ::::GETCHAR
  2655. #include \<stdio.h>
  2656. int getchar( void );
  2657.  
  2658. The getchar function is equivalent to getc with the argument stdin.
  2659. ::::GETCHE
  2660. #include \<conio.h>
  2661. int getche( void );
  2662.  
  2663. The getche  function  obtains the next    available  keystroke  from the
  2664. console.  The function will wait until a keystroke is available.  That
  2665. character  is echoed on the screen at the  position of the cursor (use
  2666. getch when it is not desired to echo the keystroke).
  2667.  
  2668. The  kbhit  function  can be  used  to    determine  if a  keystroke  is
  2669. available.
  2670. ::::GETCMD
  2671. #include \<process.h>
  2672. char *getcmd( char *cmd_line );
  2673.  
  2674. The  getcmd  function  causes the command line    information,  with the
  2675. program name  removed, to be copied to    "cmd_line". The information is
  2676. terminated with a '\0' character.  This provides a method of obtaining
  2677. the original  parameters  to a program unchanged (with the white space
  2678. intact).
  2679.  
  2680. This  information  can    also  be  obtained by examining  the vector of
  2681. program parameters passed to the main function in the program.
  2682. ::::GETCWD
  2683. #include \<direct.h>
  2684. char *getcwd( char *buffer, int size );
  2685.  
  2686. The getcwd function returns the name of the current working directory.
  2687. The  "buffer"  address is either  NULL or is the  location  at which a
  2688. string containing the name of the current working directory is placed.
  2689. In the latter  case, the value of "size" is the length    (including the
  2690. delimiting '\0' character) which can be be used to store this name.
  2691.  
  2692. When  "buffer"    has a value of NULL, a string is  allocated to contain
  2693. the name of the current working directory.    This string may be freed
  2694. using the free function.
  2695. ::::GETENV
  2696. #include \<stdlib.h>
  2697. char *getenv( const char *name );
  2698.  
  2699. The  getenv  function  searches  the  environment  list  for an  entry
  2700. matching   the    string     pointed  to  by  "name".   The   matching  is
  2701. case-insensitive;  all    lower-case letters are treated as if they were
  2702. in upper case.
  2703.  
  2704. Entries  can be added to the environment list with the DOS set command
  2705. or  with  the  putenv  or  setenv  functions.     All  entries  in  the
  2706. environment list can be displayed by using the DOS set command with no
  2707. arguments.
  2708.  
  2709. To assign a string to a variable and place it in the environment list:
  2710.  
  2711.     C>SET INCLUDE=C:\WATCOM\H
  2712.  
  2713. To see what  variables    are in the environment list, and their current
  2714. assignments:
  2715.  
  2716.     C>SET
  2717.     COMSPEC=C:\COMMAND.COM
  2718.     PATH=C:\;C:\WATCOM
  2719.     INCLUDE=C:\WATCOM\H
  2720.  
  2721.     C>
  2722. ::::GETPID
  2723. #include \<process.h>
  2724. int getpid(void);
  2725.  
  2726. The getpid function returns the process id for the current process.
  2727. ::::GETS
  2728. #include \<stdio.h>
  2729. char *gets( char *buf );
  2730.  
  2731. The gets function gets a string of characters from the file designated
  2732. by stdin  and  stores  them in the  array  pointed  to by "buf"  until
  2733. end-of-file  is  encountered  or a  new-line  character is read.   Any
  2734. new-line  character  is  discarded,  and a null  character  is    placed
  2735. immediately after the last character read into the array.
  2736.  
  2737. It is  recommended  that fgets be used    instead of gets  because  data
  2738. beyond the array  "buf" will be  destroyed  if a new-line character is
  2739. not read from the input stream stdin before the end of the array "buf"
  2740. is reached.
  2741. ::::GMTIME
  2742. #include \<time.h>
  2743. struct tm *gmtime( const time_t *timer );
  2744.  
  2745. struct    tm {
  2746.   int tm_sec;    /* seconds after the minute -- [0,61] */
  2747.   int tm_min;    /* minutes after the hour   -- [0,59] */
  2748.   int tm_hour;    /* hours after midnight     -- [0,23] */
  2749.   int tm_mday;    /* day of the month        -- [1,31] */
  2750.   int tm_mon;    /* months since January     -- [0,11] */
  2751.   int tm_year;    /* years since 1900              */
  2752.   int tm_wday;    /* days since Sunday        -- [0,6]  */
  2753.   int tm_yday;    /* days since January 1     -- [0,365]*/
  2754.   int tm_isdst; /* Daylight Savings Time flag */
  2755. };
  2756.  
  2757. The gmtime  function  converts the calendar time pointed to by "timer"
  2758. into a broken-down time, expressed as Coordinated Universal Time (UTC)
  2759. (formerly known as Greenwich Mean Time (GMT)).
  2760.  
  2761. The time set on the  computer  with the DOS time  command  and the DOS
  2762. date command reflects the local time.    The environment variable TZ is
  2763. used to establish the time zone to which this local time applies.  See
  2764. the section The TZ Environment Variable for a discussion of how to set
  2765. the time zone.
  2766. ::::HALLOC
  2767. #include \<malloc.h>
  2768. void __huge *halloc( long int numb, size_t size );
  2769.  
  2770. The halloc  function allocates space for an array of "numb" objects of
  2771. "size" bytes each and initializes each object to 0.   When the size of
  2772. the array is greater than 128K bytes, the size must be a power of 2.
  2773. ::::HEAP
  2774.                 Heap Functions
  2775.                 ══════════════
  2776.  
  2777. These  functions  provide  the ability to shrink and grow the heap, as
  2778. well as, find heap  related  problems.    The  following    functions  are
  2779. defined:
  2780.  
  2781. <_heapchk>    perform consistency check on the heap
  2782. <_fheapchk>    perform consistency check on the far heap
  2783. <_nheapchk>    perform consistency check on the near heap
  2784. <_heapgrow>    grow the heap
  2785. <_fheapgrow>    grow the far heap
  2786. <_nheapgrow>    grow the near heap up to its limit of 64K
  2787. <_heapmin>    shrink the heap as small as possible
  2788. <_fheapmin>    shrink the far heap as small as possible
  2789. <_nheapmin>    shrink the near heap as small as possible
  2790. <_heapset>    fill unallocated sections of heap with pattern
  2791. <_fheapset>    fill unallocated sections of far heap with pattern
  2792. <_nheapset>    fill unallocated sections of near heap with pattern
  2793. <_heapshrink>    shrink the heap as small as possible
  2794. <_fheapshrink>    shrink the far heap as small as possible
  2795. <_nheapshrink>    shrink the near heap as small as possible
  2796. <_heapwalk>    walk through each entry in the heap
  2797. <_fheapwalk>    walk through each entry in the far heap
  2798. <_nheapwalk>    walk through each entry in the near heap
  2799. ::::HFREE
  2800. #include \<malloc.h>
  2801. void hfree( void __huge *ptr );
  2802.  
  2803. The hfree function  deallocates a memory block previously allocated by
  2804. the halloc function.    The argument "ptr" points to a memory block to
  2805. be  deallocated.   After  the  call, the freed block is available  for
  2806. allocation.
  2807. ::::HYPOT
  2808. #include \<math.h>
  2809. double hypot( double x, double y );
  2810.  
  2811. The hypot  function  computes  the length of the hypotenuse of a right
  2812. triangle  whose  sides are "x" and "y"    adjacent  to that right angle.
  2813. The calculation is equivalent to
  2814.  
  2815.     sqrt( x*x + y*y )
  2816.  
  2817. The  computation  may  cause an  overflow,  in which case the  matherr
  2818. function will be invoked.
  2819. ::::INP
  2820. #include \<conio.h>
  2821. unsigned int inp( int port );
  2822.  
  2823. The inp function reads one byte from the hardware port whose number is
  2824. given by "port".
  2825.  
  2826. A  hardware  port is used to  communicate  with a device.   One or two
  2827. bytes can be read  and/or  written  from each port, depending upon the
  2828. hardware.   Consult the technical  documentation  for your computer to
  2829. determine the port numbers for a device and the expected usage of each
  2830. port for a device.
  2831. ::::INPW
  2832. #include \<conio.h>
  2833. unsigned int inpw( int port );
  2834.  
  2835. The inpw  function  reads a word (two  bytes)  from the  hardware port
  2836. whose number is given by "port".
  2837.  
  2838. A  hardware  port is used to  communicate  with a device.   One or two
  2839. bytes can be read  and/or  written  from each port, depending upon the
  2840. hardware.   Consult the technical  documentation  for your computer to
  2841. determine the port numbers for a device and the expected usage of each
  2842. port for a device.
  2843. ::::INT386
  2844. #include \<dos.h>
  2845. int int386( int inter_no,
  2846.        const union REGS *in_regs,
  2847.        union REGS *out_regs );
  2848.  
  2849. The int386  function  causes the computer's central processor (CPU) to
  2850. be  interrupted with an interrupt whose number is given by "inter_no".
  2851. This function is present in the 386 C libraries and may be executed on
  2852. 80386/486 systems.  Before the interrupt, the CPU registers are loaded
  2853. from the structure  located by "in_regs". Following the interrupt, the
  2854. structure located by "out_regs" is filled with the contents of the CPU
  2855. registers.   These  structures    may be located at the same location in
  2856. memory.
  2857.  
  2858. You should consult the technical  documentation  for the computer that
  2859. you are using to determine  the expected  register contents before and
  2860. after the interrupt in question.
  2861. ::::INT386X
  2862. #include \<dos.h>
  2863. int int386x( int inter_no,
  2864.          const union REGS *in_regs,
  2865.          union REGS *out_regs,
  2866.          struct SREGS *seg_regs );
  2867.  
  2868. The int386x  function causes the computer's central processor (CPU) to
  2869. be  interrupted with an interrupt whose number is given by "inter_no".
  2870. This function is present in the 386 C libraries and may be executed on
  2871. 80386/486 systems.  Before the interrupt, the CPU registers are loaded
  2872. from  the  structure  located by  "in_regs"  and the DS, ES, FS and GS
  2873. segment registers are loaded from the structure located by "seg_regs".
  2874. Following the interrupt, the structure located by "out_regs" is filled
  2875. with the contents of the CPU registers.   The "in_regs" and "out_regs"
  2876. structures  may be  located  at the  same  location  in memory.    The
  2877. original values of the DS, ES, FS and GS registers are restored.   The
  2878. structure  "seg_regs"  is  updated  with  the  values  of the  segment
  2879. registers following the interrupt.
  2880.  
  2881. You should consult the technical  documentation  for the computer that
  2882. you are using to determine  the expected  register contents before and
  2883. after the interrupt in question.
  2884. ::::INT86
  2885. #include \<dos.h>
  2886. int int86( int inter_no,
  2887.        const union REGS *in_regs,
  2888.        union REGS *out_regs );
  2889.  
  2890. The int86 function causes the computer's central processor (CPU) to be
  2891. interrupted  with  an interrupt  whose number is given by  "inter_no".
  2892. Before the  interrupt, the CPU registers are loaded from the structure
  2893. located by "in_regs".  Following the interrupt, the structure  located
  2894. by "out_regs" is filled with the contents of the CPU registers.  These
  2895. structures may be located at the same location in memory.
  2896.  
  2897. You should consult the technical  documentation  for the computer that
  2898. you are using to determine  the expected  register contents before and
  2899. after the interrupt in question.
  2900. ::::INT86X
  2901. #include \<dos.h>
  2902. int int86x( int inter_no,
  2903.         const union REGS *in_regs,
  2904.         union REGS *out_regs,
  2905.         struct SREGS *seg_regs );
  2906.  
  2907. The int86x  function  causes the computer's central processor (CPU) to
  2908. be  interrupted with an interrupt whose number is given by "inter_no".
  2909. Before the  interrupt, the CPU registers are loaded from the structure
  2910. located by  "in_regs"  and the DS and ES segment  registers are loaded
  2911. from the structure located by "seg_regs". Following the interrupt, the
  2912. structure located by "out_regs" is filled with the contents of the CPU
  2913. registers.   The "in_regs" and "out_regs" structures may be located at
  2914. the same  location  in memory.     The  original values of the DS and ES
  2915. registers are restored.   The structure "seg_regs" is updated with the
  2916. values of the segment registers following the interrupt.
  2917.  
  2918. You should consult the technical  documentation  for the computer that
  2919. you are using to determine  the expected  register contents before and
  2920. after the interrupt in question.
  2921. ::::INTDOS
  2922. #include \<dos.h>
  2923. int intdos( const union REGS *in_regs,
  2924.         union REGS *out_regs );
  2925.  
  2926. The intdos  function  causes the computer's central processor (CPU) to
  2927. be  interrupted with an interrupt number hexadecimal 21 ( 0x21), which
  2928. is a request to invoke a specific DOS function.  Before the interrupt,
  2929. the CPU  registers are loaded from the structure located by "in_regs".
  2930. The AH register  contains a number  indicating the function requested.
  2931. Following the interrupt, the structure located by "out_regs" is filled
  2932. with  the  contents of the CPU    registers.   These  structures    may be
  2933. located at the same location in memory.
  2934.  
  2935. You should  consult the  technical documentation for the DOS operating
  2936. system that you are using to determine    the expected register contents
  2937. before and after the interrupt in question.
  2938. ::::INTDOSX
  2939. #include \<dos.h>
  2940. int intdosx( const union REGS *in_regs,
  2941.          union REGS *out_regs,
  2942.          struct SREGS *seg_regs );
  2943.  
  2944. The intdosx  function causes the computer's central processor (CPU) to
  2945. be  interrupted with an interrupt number hexadecimal 21 ( 0x21), which
  2946. is a request to invoke a specific DOS function.  Before the interrupt,
  2947. the CPU  registers  are loaded from the structure located by "in_regs"
  2948. and the  segment  registers  DS and ES are loaded  from the  structure
  2949. located by  "seg_regs".  The AH register  contains a number indicating
  2950. the  function  requested.   Following  the  interrupt,    the  structure
  2951. located  by  "out_regs"  is  filled  with  the    contents  of  the  CPU
  2952. registers.   The "in_regs" and "out_regs" structures may be located at
  2953. the same  location  in memory.     The original values for the DS and ES
  2954. registers are restored.   The structure "seg_regs" is updated with the
  2955. values of the segment registers following the interrupt.
  2956.  
  2957. You should  consult the  technical documentation for the DOS operating
  2958. system that you are using to determine    the expected register contents
  2959. before and after the interrupt in question.
  2960. ::::INTEL
  2961.           Intel 80x86 Architecture-Specific Functions
  2962.           ═══════════════════════════════════════════
  2963.  
  2964. These    functions   provide  the  capability  to  invoke  Intel  80x86
  2965. processor-related functions directly from a program.    Functions that
  2966. apply to the Intel 8086 CPU apply to that  family including the 80286,
  2967. 80386 and 80486 processors.  The following functions are defined:
  2968.  
  2969. <_chain_intr>    chain to the previous interrupt handler
  2970. <_disable>    disable interrupts
  2971. <_enable>    enable interrupts
  2972. <FP_OFF>    get offset part of far pointer
  2973. <FP_SEG>    get segment part of far pointer
  2974. <inp>        get one byte from hardware port
  2975. <inpw>        get two bytes (one word) from hardware port
  2976. <int386>    cause 386/486 CPU interrupt
  2977. <int386x>    cause 386/486 CPU interrupt, with segment registers
  2978. <int86>     cause 8086 CPU interrupt
  2979. <int86x>    cause 8086 CPU interrupt, with segment registers
  2980. <intr>        cause 8086 CPU interrupt, with segment registers
  2981. <MK_FP>     make a far pointer from the segment and offset values
  2982. <nosound>    turn off the speaker
  2983. <outp>        write one byte to hardware port
  2984. <outpw>     write two bytes (one word) to hardware port
  2985. <segread>    read segment registers
  2986. <sound>     turn on the speaker at specified frequency
  2987. ::::INTR
  2988. #include \<dos.h>
  2989. void intr( int inter_no, union REGPACK *regs );
  2990.  
  2991. The intr  function causes the computer's central processor (CPU) to be
  2992. interrupted  with  an interrupt  whose number is given by  "inter_no".
  2993. Before the  interrupt, the CPU registers are loaded from the structure
  2994. located by "regs".  Following the interrupt, the structure  located by
  2995. "regs" is filled with the contents of the CPU registers.
  2996.  
  2997. This  function is similar to the int86x function, except that only one
  2998. structure  is used for the register values and that the BP (EBP in 386
  2999. library)  register is included in the set of registers that are passed
  3000. and saved.
  3001.  
  3002. You should consult the technical  documentation  for the computer that
  3003. you are using to determine  the expected  register contents before and
  3004. after the interrupt in question.
  3005. ::::ISALNUM
  3006. #include \<ctype.h>
  3007. int isalnum( int c );
  3008.  
  3009. The isalnum  tests if the argument "c" is an alphanumeric character (a
  3010. to z, A to Z, or 0 to 9).   An alphanumeric character is any character
  3011. for which isalpha or isdigit is true.
  3012. ::::ISALPHA
  3013. #include \<ctype.h>
  3014. int isalpha( int c );
  3015.  
  3016. The isalpha tests for an alphabetic character (a to z and A to Z).  An
  3017. alphabetic  character is any character for which isupper or islower is
  3018. true.
  3019. ::::ISASCII
  3020. #include \<ctype.h>
  3021. int isascii( int c );
  3022.  
  3023. The isascii function tests for a character in the range from 0 to 127.
  3024. ::::ISATTY
  3025. #include \<io.h>
  3026. int isatty( int handle );
  3027.  
  3028. The isatty  function  tests if the opened file or device referenced by
  3029. the  file  handle  "handle"  is a  character  device  (for  example, a
  3030. console, printer or port).
  3031. ::::ISCNTRL
  3032. #include \<ctype.h>
  3033. int iscntrl( int c );
  3034.  
  3035. The  iscntrl  function    tests  for any control    character.   A control
  3036. character is any character whose value is from 0 through 31.
  3037. ::::ISDIGIT
  3038. #include \<ctype.h>
  3039. int isdigit( int c );
  3040.  
  3041. The isdigit function tests for any decimal-digit character '0' through
  3042. '9'.
  3043. ::::ISGRAPH
  3044. #include \<ctype.h>
  3045. int isgraph( int c );
  3046.  
  3047. The isgraph function tests for any  printable  character  except space
  3048. (' ').     The  isprint  function  is  similar,  except  that  the space
  3049. character is also included in the character set being tested.
  3050. ::::ISLOWER
  3051. #include \<ctype.h>
  3052. int islower( int c );
  3053.  
  3054. The islower function tests for any lower-case letter 'a' through 'z'.
  3055. ::::ISPRINT
  3056. #include \<ctype.h>
  3057. int isprint( int c );
  3058.  
  3059. The isprint function tests for any printable character including space
  3060. (' ').      The  isgraph    function  is  similar,    except    that the space
  3061. character is excluded from the character set being tested.
  3062. ::::ISPUNCT
  3063. #include \<ctype.h>
  3064. int ispunct( int c );
  3065.  
  3066. The ispunct  function  tests for any  punctuation  character such as a
  3067. comma (,) or a period (.).
  3068. ::::ISSPACE
  3069. #include \<ctype.h>
  3070. int isspace( int c );
  3071.  
  3072. The isspace function tests for the following white-space characters:
  3073.  
  3074. ' '      space
  3075. '\f'      form feed
  3076. '\n'      new-line or linefeed
  3077. '\r'      carriage return
  3078. '\t'      horizontal tab
  3079. '\v'      vertical tab
  3080. ::::ISUPPER
  3081. #include \<ctype.h>
  3082. int isupper( int c );
  3083.  
  3084. The isupper function tests for any upper-case letter 'A' through 'Z'.
  3085. ::::ISXDIGIT
  3086. #include \<ctype.h>
  3087. int isxdigit( int c );
  3088.  
  3089. The  isxdigit  function  tests    for any  hexadecimal-digit  character.
  3090. These characters are the digits ('0' through '9') and the letters ('a'
  3091. through 'f') and ('A' through 'F').
  3092. ::::ITOA
  3093. #include \<stdlib.h>
  3094. char *itoa( int value, char *buffer, int radix );
  3095.  
  3096. The  itoa  function  converts  the  binary  integer  "value"  into the
  3097. equivalent  string in base "radix"  notation storing the result in the
  3098. character  array  pointed to by "buffer". A null character is appended
  3099. to the result.    The size of "buffer" must be at least (8 * sizeof(int)
  3100. + 1) bytes when converting values in base 2.    That makes the size 17
  3101. bytes on 16-bit  machines,  and 33 bytes on 32-bit  machines.    If the
  3102. value of  "radix"  is 10 and "value" is negative, then a minus sign is
  3103. prepended to the result.
  3104. ::::J0
  3105.  ->BESSEL
  3106. ::::J1
  3107.  ->BESSEL
  3108. ::::JN
  3109.  ->BESSEL
  3110. ::::KBHIT
  3111. #include \<conio.h>
  3112. int kbhit( void );
  3113.  
  3114. The kbhit  function  tests  whether or not a  keystroke  is  currently
  3115. available.  When one is available, the function getch or getche may be
  3116. used to obtain the keystroke in question.
  3117.  
  3118. With  a   stand-alone  program,  the  kbhit  function  may  be    called
  3119. continuously until a keystroke is available.
  3120. ::::LABS
  3121. #include \<stdlib.h>
  3122. long int labs( long int j );
  3123.  
  3124. The  labs  function  returns  the absolute  value of its  long-integer
  3125. argument "j".
  3126. ::::LANG_HELP
  3127.                    WATCOM C
  3128.                    ════════
  3129.  
  3130. Select the topic about which you want help. Press F1 if you want
  3131. information on how to use the help system.
  3132.  
  3133. Help is available on the following categories of WATCOM C functions.
  3134.  
  3135. <allocation>        memory allocation
  3136. <bios>            BIOS services access
  3137. <character>        character manipulation
  3138. <console>        console level I/O operations
  3139. <conversion>        convert values from one representation to another
  3140. <directory>        directory services
  3141. <dos>            DOS-specific functions access
  3142. <environment>        process environment
  3143. <file>            file manipulation
  3144. <graphics>        graphics
  3145. <heap>            heap management
  3146. <intel>         Intel 80x86 processor-related functions
  3147. <math>            mathematical and trigonometric functions
  3148. <memory>        memory block manipulation
  3149. <miscellaneous>     remaining functions
  3150. <multibyte>        multibyte and wide characters manipulation
  3151. <operating>        operating system level file operations
  3152. <process>        process primitive functions
  3153. <searching>        searching and sorting capabilities
  3154. <stream>        standard functions to read and write files
  3155. <string>        string manipulation
  3156. <time>            obtain and manipulate times and dates
  3157. <variable>        process variable numbers of arguments
  3158. ::::LDEXP
  3159. #include \<math.h>
  3160. double ldexp( double x, int exp );
  3161.  
  3162. The ldexp  function  multiplies a floating-point number by an integral
  3163. power of 2.  A range error may occur.
  3164. ::::LDIV
  3165. #include \<stdlib.h>
  3166. ldiv_t ldiv( long int numer, long int denom );
  3167.  
  3168. typedef struct {
  3169.     long int quot;     /* quotient */
  3170.     long int rem;      /* remainder */
  3171. } ldiv_t;
  3172.  
  3173. The  ldiv  function  calculates  the  quotient    and  remainder    of the
  3174. division of the numerator "numer" by the denominator "denom".
  3175. ::::LFIND
  3176. #include \<search.h>
  3177. char *lfind( char *key,       /* object to search for  */
  3178.          char *base,      /* base of search data   */
  3179.          unsigned *num,   /* number of elements    */
  3180.          unsigned width,  /* width of each element */
  3181.          int (*compare)( const void *element1,
  3182.                  const void *element2 ) );
  3183.  
  3184. The lfind function performs a linear search for the value "key" in the
  3185. array  of "num"  elements  pointed to by "base".  Each    element of the
  3186. array is "width" bytes in size.    The argument "compare" is a pointer
  3187. to a  user-supplied  routine that will be called by lfind to determine
  3188. the  relationship  of an  array  element  with    the  "key". One of the
  3189. arguments  to the "compare" function will be an array element, and the
  3190. the other will be "key".
  3191.  
  3192. The  "compare"    function should return 0 if "element1" is identical to
  3193. "element2" and non-zero if the elements are not identical.
  3194. ::::LOCALECONV
  3195. #include \<locale.h>
  3196. struct lconv *localeconv( void );
  3197.  
  3198. The  localeconv  function  sets  the  components  of an object of type
  3199. struct lconv with values  appropriate  for the    formatting  of numeric
  3200. quantities  according to the current  locale.    The  components of the
  3201. struct lconv and their meanings are as follows:
  3202.  
  3203. char *decimal_point
  3204.       The  decimal-point  character  used to  format  non-monetary
  3205.       quantities.
  3206.  
  3207. char *thousands_sep
  3208.       The  character used to separate groups of digits to the left
  3209.       of the  decimal-point  character  in formatted  non-monetary
  3210.       quantities.
  3211.  
  3212. char *grouping
  3213.       A string  whose  elements indicate the size of each group of
  3214.       digits in formatted non-monetary quantities.
  3215.  
  3216. char *int_curr_symbol
  3217.       The  international currency symbol applicable to the current
  3218.       locale.    The first three characters contain the alphabetic
  3219.       international  currency  symbol  in  accordance  with  those
  3220.       specified  in ISO  4217  Codes  for  the  Representation  of
  3221.       Currency  and  Funds.   The  fourth  character  (immediately
  3222.       preceding  the  null    character)  is the  character  used to
  3223.       separate the international currency symbol from the monetary
  3224.       quantity.
  3225.  
  3226. char *currency_symbol
  3227.       The local currency symbol applicable to the current locale.
  3228.  
  3229. char *mon_decimal_point
  3230.       The    decimal-point    character  used  to  format   monetary
  3231.       quantities.
  3232.  
  3233. char *mon_thousands_sep
  3234.       The  character used to separate groups of digits to the left
  3235.       of  the   decimal-point   character  in  formatted  monetary
  3236.       quantities.
  3237.  
  3238. char *mon_grouping
  3239.       A string  whose  elements indicate the size of each group of
  3240.       digits in formatted monetary quantities.
  3241.  
  3242. char *positive_sign
  3243.       The  string used to indicate a  nonnegative-valued  monetary
  3244.       quantity.
  3245.  
  3246. char *negative_sign
  3247.       The  string  used  to  indicate a  negative-valued  monetary
  3248.       quantity.
  3249.  
  3250. char int_frac_digits
  3251.       The number of  fractional  digits (those to the right of the
  3252.       decimal-point)   to  be  displayed  in  an   internationally
  3253.       formatted monetary quantity.
  3254.  
  3255. char frac_digits
  3256.       The number of  fractional  digits (those to the right of the
  3257.       decimal-point)  to  be  displayed  in a  formatted  monetary
  3258.       quantity.
  3259.  
  3260. char p_cs_precedes
  3261.       Set to 1 or 0 if the    currency_symbol  respectively precedes
  3262.       or follows the value for a  nonnegative  formatted  monetary
  3263.       quantity.
  3264.  
  3265. char p_sep_by_space
  3266.       Set to 1 or 0 if the    currency_symbol  respectively is or is
  3267.       not  separated  by a space from the value for a  nonnegative
  3268.       formatted monetary quantity.
  3269.  
  3270. char n_cs_precedes
  3271.       Set to 1 or 0 if the    currency_symbol  respectively precedes
  3272.       or  follows  the  value  for a negative  formatted  monetary
  3273.       quantity.
  3274.  
  3275. char n_sep_by_space
  3276.       Set to 1 or 0 if the    currency_symbol  respectively is or is
  3277.       not  separated  by a space  from the    value  for a  negative
  3278.       formatted monetary quantity.
  3279.  
  3280. char p_sign_posn
  3281.       The  position  of  the   positive_sign   for    a  nonnegative
  3282.       formatted monetary quantity.
  3283.  
  3284. char n_sign_posn
  3285.       The position of the  positive_sign  for a negative formatted
  3286.       monetary quantity.
  3287.  
  3288. The elements of grouping and mon_grouping are interpreted according to
  3289. the following:
  3290.  
  3291. CHAR_MAX    No further grouping is to be performed.
  3292.  
  3293. 0        The  previous  element  is to be  repeatedly  used for the
  3294.         remainder of the digits.
  3295.  
  3296. other        The  value    is the    number    of digits  that  comprise  the
  3297.         current group.   The next element is examined to determine
  3298.         the size of the next  group of  digits  to the left of the
  3299.         current group.
  3300.  
  3301. The value of p_sign_posn and n_sign_posn is interpreted as follows:
  3302.  
  3303. 0      Parentheses surround the quantity and currency_symbol.
  3304.  
  3305. 1      The sign string precedes the quantity and currency_symbol.
  3306.  
  3307. 2      The sign string follows the quantity and currency_symbol.
  3308.  
  3309. 3      The  sign   string   immediately   precedes  the  quantity  and
  3310.        currency_symbol.
  3311.  
  3312. 4      The  sign   string   immediately   follows   the  quantity  and
  3313.        currency_symbol.
  3314. ::::LOCALTIME
  3315. #include \<time.h>
  3316. struct tm *localtime( const time_t *timer );
  3317.  
  3318. struct    tm {
  3319.   int tm_sec;    /* seconds after the minute -- [0,61] */
  3320.   int tm_min;    /* minutes after the hour   -- [0,59] */
  3321.   int tm_hour;    /* hours after midnight     -- [0,23] */
  3322.   int tm_mday;    /* day of the month        -- [1,31] */
  3323.   int tm_mon;    /* months since January     -- [0,11] */
  3324.   int tm_year;    /* years since 1900              */
  3325.   int tm_wday;    /* days since Sunday        -- [0,6]  */
  3326.   int tm_yday;    /* days since January 1     -- [0,365]*/
  3327.   int tm_isdst; /* Daylight Savings Time flag */
  3328. };
  3329.  
  3330. The  localtime    function  converts  the  calendar  time  pointed to by
  3331. "timer" into a structure of type tm, of time information, expressed as
  3332. local time.
  3333.  
  3334. The  calendar  time is usually    obtained  by using the time  function.
  3335. That  time is  Coordinated  Universal  Time (UTC)  (formerly  known as
  3336. Greenwich Mean Time (GMT)).
  3337.  
  3338. The time set on the  computer  with the DOS time  command  and the DOS
  3339. date command reflects the local time.    The environment variable TZ is
  3340. used to establish the time zone to which this local time applies.  See
  3341. the section The TZ Environment Variable for a discussion of how to set
  3342. the time zone.
  3343. ::::LOCK
  3344. #include \<io.h>
  3345. int lock( int handle,
  3346.       unsigned long offset,
  3347.       unsigned long nbytes );
  3348.  
  3349. The lock function locks "nbytes" amount of data in the file designated
  3350. by  "handle"  starting    at byte  "offset" in the file.     This prevents
  3351. other  processes  from reading or writing into the locked region until
  3352. an  unlock  has  been done for this  locked  region of the file.   All
  3353. locked regions of a file must be unlocked before a file is closed.
  3354. ::::LOCKING
  3355. #include \<sys\locking.h>
  3356. int locking( int handle, int mode, long nbyte );
  3357.  
  3358. The  locking  function    locks  or  unlocks  "nbyte"  bytes of the file
  3359. specified  by  "handle".  Locking  a region of a file  prevents  other
  3360. processes  from reading or writing the locked  region until the region
  3361. has  been  unlocked.   The  locking and  unlocking  takes place at the
  3362. current file position.    The argument "mode" specifies the action to be
  3363. performed.  The possible values for mode are:
  3364.  
  3365. LK_LOCK        Locks the specified region.  The function will retry to
  3366.            lock  the  region   after  1  second   intervals  until
  3367.            successful or until 10 attempts have been made.
  3368.  
  3369. LK_RLCK        Same action as LK_LOCK.
  3370.  
  3371. LK_NBLCK       Non-blocking  lock:   makes  only 1 attempt to lock the
  3372.            specified region.
  3373.  
  3374. LK_NBRLCK      Same action as LK_NBLCK.
  3375.  
  3376. LK_UNLCK       Unlocks    the  specified    region.   The region must have
  3377.            been previously locked.
  3378.  
  3379. Multiple  regions of a file can be locked,  but no overlapping regions
  3380. are allowed.   You cannot  unlock  multiple  regions in the same call,
  3381. even  if the regions are  contiguous.    All locked  regions  should be
  3382. unlocked  before  closing  a file  or  exiting    the program.   Locking
  3383. requires  MS-DOS Version 3.0 or later, and that SHARE.COM or SHARE.EXE
  3384. is installed.
  3385. ::::LOG
  3386. #include \<math.h>
  3387. double log( double x );
  3388.  
  3389. The log  function  computes  the  natural logarithm (base e) of "x". A
  3390. domain error occurs if the argument is negative.  A range error occurs
  3391. if the argument is zero.
  3392. ::::LOG10
  3393. #include \<math.h>
  3394. double log10( double x );
  3395.  
  3396. The log10  function  computes the logarithm (base 10) of "x". A domain
  3397. error occurs if the argument is negative.  A range error occurs if the
  3398. argument is zero.
  3399. ::::LOG2
  3400. #include \<math.h>
  3401. double log2( double x );
  3402.  
  3403. The log2  function  computes  the  logarithm (base 2) of "x". A domain
  3404. error occurs if the argument is negative.  A range error occurs if the
  3405. argument is zero.
  3406. ::::LONGJMP
  3407. #include \<setjmp.h>
  3408. void longjmp( jmp_buf env, int return_value );
  3409.  
  3410. The longjmp function restores the environment saved by the most recent
  3411. call to the setjmp function with the corresponding jmp_buf argument.
  3412. ::::LSEARCH
  3413. #include \<search.h>
  3414. char *lsearch( char *key,      /* object to search for */
  3415.            char *base,     /* base of search data  */
  3416.            unsigned *num,  /* number of elements   */
  3417.            unsigned width, /* width of each element*/
  3418.            int (*compare)( const void *element1,
  3419.                    const void *element2 ) );
  3420.  
  3421. The  lsearch  function performs a linear search for the value "key" in
  3422. the array of "num"  elements pointed to by "base". Each element of the
  3423. array is "width" bytes in size.    The argument "compare" is a pointer
  3424. to a user-supplied routine that will be called by lsearch to determine
  3425. the  relationship  of an  array  element  with    the  "key". One of the
  3426. arguments  to the "compare" function will be an array element, and the
  3427. the other will be "key".
  3428.  
  3429. The  "compare"    function should return 0 if "element1" is identical to
  3430. "element2" and non-zero if the elements are not identical.
  3431. ::::LSEEK
  3432. #include \<io.h>
  3433. #include \<stdio.h>
  3434. long int lseek( int handle, long int offset, int whence );
  3435.  
  3436. The lseek  function  sets the current file  position at the  operating
  3437. system level.     The file is referenced using the file handle "handle"
  3438. returned  by a    successful  execution  of one of the creat, dup, dup2,
  3439. open or sopen functions.   The value of "offset" is used as a relative
  3440. offset    from a file  position  determined by the value of the argument
  3441. "whence".
  3442.  
  3443. The new file  position    is  determined    in a manner dependent upon the
  3444. value of "whence" which may have one of three possible values (defined
  3445. in the \<stdio.h> header file):
  3446.  
  3447. SEEK_SET       The new file position is computed relative to the start
  3448.            of  the    file.     The  value  of  "offset"  must not be
  3449.            negative.
  3450.  
  3451. SEEK_CUR       The  new file  position    is  computed  relative    to the
  3452.            current    file  position.   The value of "offset" may be
  3453.            positive, negative or zero.
  3454.  
  3455. SEEK_END       The new file  position  is computed relative to the end
  3456.            of the file.
  3457.  
  3458. An error will occur if the requested file position is before the start
  3459. of the file.
  3460.  
  3461. The  requested    file  position may be beyond the end of the file.   If
  3462. data is later  written at this    point, subsequent reads of data in the
  3463. gap  will  return  bytes  whose  value    is equal to zero until data is
  3464. actually written in the gap.
  3465.  
  3466. The lseek function does not, in itself, extend the size of a file (see
  3467. the description of the chsize function).
  3468. ::::LTOA
  3469. #include \<stdlib.h>
  3470. char *ltoa( long int value,
  3471.         char *buffer,
  3472.         int radix );
  3473.  
  3474. The  ltoa  function  converts  the  binary  integer  "value"  into the
  3475. equivalent  string in base "radix"  notation storing the result in the
  3476. character  array  pointed to by "buffer". A null character is appended
  3477. to the    result.   The size of  "buffer" must be at least 33 bytes when
  3478. converting  values  in    base 2.   If the  value of  "radix"  is 10 and
  3479. "value" is negative, then a minus sign is prepended to the result.
  3480. ::::MAIN
  3481. int main( void );
  3482. int main( int argc, const char *argv[] );
  3483.  
  3484. The function main is a    user-supplied function where program execution
  3485. begins.   The command line to the program is broken into a sequence of
  3486. tokens    separated  by  blanks  and  are  passed to main as an array of
  3487. pointers to character  strings in the  parameter "argv". The number of
  3488. arguments  found is passed in the  parameter "argc". The first element
  3489. of  "argv"  will be a pointer to a  character  string  containing  the
  3490. program name.  The last element of the array pointed to by "argv" will
  3491. be a NULL pointer (i.e.    "argv[argc]" will be NULL).    Arguments that
  3492. contain  blanks can be passed to main by  enclosing them within double
  3493. quote  characters  (which  are removed from that element in the "argv"
  3494. vector.
  3495.  
  3496. The command line arguments can also be obtained in its original format
  3497. by using the getcmd function.
  3498. ::::MALLOC
  3499. #include \<stdlib.h>
  3500. void *malloc( size_t size );
  3501.  
  3502. The malloc  function  allocates  space for an object of "size"    bytes.
  3503. Nothing is allocated when the "size" argument has a value of zero.
  3504.  
  3505. In a small data memory model, the malloc function is equivalent to the
  3506. _nmalloc  function; in a large data memory  model, the malloc function
  3507. is equivalent to the _fmalloc function.
  3508. ::::MATH
  3509.                 Math Functions
  3510.                 ══════════════
  3511.  
  3512. These  functions  operate  with  objects of type double, also known as
  3513. floating-point numbers.    The Intel 8087 processor (and its successor
  3514. chips)    is  commonly  used to implement  floating-point  operations on
  3515. personal computers.  Functions ending in "87" pertain to this specific
  3516. hardware  and  should be isolated in programs  when  portability  is a
  3517. consideration.    The following functions are defined:
  3518.  
  3519. <abs>        absolute value of an object of type int
  3520. <acos>        arccosine
  3521. <acosh>     inverse hyperbolic cosine
  3522. <asin>        arcsine
  3523. <asinh>     inverse hyperbolic sine
  3524. <atan>        arctangent of one argument
  3525. <atan2>     arctangent of two arguments
  3526. <atanh>     inverse hyperbolic tangent
  3527. <bessel>    bessel functions j0, j1, jn, y0, y1, and yn
  3528. <cabs>        absolute value of complex number
  3529. <ceil>        ceiling function
  3530. <_clear87>    clears floating-point status
  3531. <_control87>    sets new floating-point control word
  3532. <cos>        cosine
  3533. <cosh>        hyperbolic cosine
  3534. <div>        compute  quotient,  remainder  from division of an int
  3535.         object
  3536. <exp>        exponential function
  3537. <fabs>        absolute value of double
  3538. <floor>     floor function
  3539. <fmod>        modulus function
  3540. <_fpreset>    initializes for floating-point operations
  3541. <frexp>     fractional exponent
  3542. <hypot>     compute hypotenuse
  3543. <j0> <j1> <jn>    return Bessel functions of the first kind
  3544. <labs>        absolute value of an object of type long int
  3545. <ldexp>     multiply by a power of two
  3546. <ldiv>        get  quotient,    remainder  from  division of object of
  3547.         type long int
  3548. <log>        natural logarithm
  3549. <log10>     logarithm, base 10
  3550. <log2>        logarithm, base 2
  3551. <matherr>    handles error from math functions
  3552. <max>        return maximum of two arguments
  3553. <min>        return minimum of two arguments
  3554. <modf>        get integral, fractional parts of double
  3555. <pow>        raise to power
  3556. <rand>        random integer
  3557. <sin>        sine
  3558. <sinh>        hyperbolic sine
  3559. <sqrt>        square root
  3560. <srand>     set starting  point for  generation  of random numbers
  3561.         using rand function
  3562. <_status87>    gets floating-point status
  3563. <tan>        tangent
  3564. <tanh>        hyperbolic tangent
  3565. <y0> <y1> <yn>    return Bessel functions of the second kind
  3566. ::::MATHERR
  3567. #include \<math.h>
  3568. int matherr( struct exception *err_info );
  3569.  
  3570. The  matherr  function    is invoked  each time an error is  detected by
  3571. functions in the math library.     The default matherr function supplied
  3572. in the    library  returns  zero    which  causes  an error  message to be
  3573. displayed  upon  stderr and errno to be set with an  appropriate error
  3574. value.     An  alternative  version  of  this  function can be provided,
  3575. instead of the    library  version, in order that the error handling for
  3576. mathematical errors can be handled by an application.
  3577.  
  3578. A program  may    contain a  user-written version of matherr to take any
  3579. appropriate action when an error is detected.    When zero is returned,
  3580. an error  message will be printed upon stderr and errno will be set as
  3581. was  the case with the    default  function.   When a non-zero  value is
  3582. returned, no message is printed and errno is not changed.    The value
  3583. err_info->retval is used as the return value for the function in which
  3584. the error was detected.
  3585.  
  3586. The  matherr  function    is  passed a pointer to an  structure  of type
  3587. struct    exception  which contains information about the error that has
  3588. been detected:
  3589.  
  3590. struct exception
  3591. { int type;     /* TYPE OF ERROR         */
  3592.   char *name;     /* NAME OF FUNCTION         */
  3593.   double arg1;     /* FIRST ARGUMENT TO FUNCTION     */
  3594.   double arg2;     /* SECOND ARGUMENT TO FUNCTION  */
  3595.   double retval; /* DEFAULT RETURN VALUE     */
  3596. };
  3597.  
  3598. The type field will contain one of the following values:
  3599.  
  3600. DOMAIN           A domain error has occurred, such as sqrt(-1e0).
  3601.  
  3602. SING           A singularity will result, such as pow(0e0,-2).
  3603.  
  3604. OVERFLOW       An overflow will result, such as pow(10e0,100).
  3605.  
  3606. UNDERFLOW      An underflow will result, such as pow(10e0,-100).
  3607.  
  3608. TLOSS           Total  loss  of     significance  will  result,  such  as
  3609.            exp(1000).
  3610.  
  3611. PLOSS           Partial    loss  of  significance    will  result,  such as
  3612.            sin(10e70).
  3613.  
  3614. The name field    points to a string containing the name of the function
  3615. which detected the error.  The fields arg1 and arg2 (if required) give
  3616. the  values  which  caused the error.    The field retval  contains the
  3617. value  which  will be  returned  by the  function.   This value may be
  3618. changed by a user-supplied version of the matherr function.
  3619. ::::MAX
  3620. #include \<stdlib.h>
  3621.  
  3622. The max  macro    will evaluate to be the greater of two values.     It is
  3623. implemented as follows.
  3624.  
  3625. #define max(a,b)  (((a) > (b)) ? (a) : (b))
  3626. ::::MBLEN
  3627. #include \<stdlib.h>
  3628. int mblen( const char *s, size_t n );
  3629.  
  3630. The  mblen  function  determines  the number of bytes  comprising  the
  3631. multibyte  character pointed to by "s". At most "n" bytes of the array
  3632. pointed to by "s" will be examined.
  3633. ::::MBSTOWCS
  3634. #include \<stdlib.h>
  3635. size_t mbstowcs( wchar_t *pwcs,const char *s,size_t n );
  3636.  
  3637. The  mbstowcs  function  converts  a sequence of multibyte  characters
  3638. pointed to by "s" into their  corresponding  wide  character codes and
  3639. stores    not  more than "n" codes into the array  pointed to by "pwcs".
  3640. The mbstowcs function does not convert any multibyte characters beyond
  3641. the null character.    At most "n" elements of the array pointed to by
  3642. "pwcs" will be modified.
  3643. ::::MBTOWC
  3644. #include \<stdlib.h>
  3645. int mbtowc( wchar_t *pwc, const char *s, size_t n );
  3646.  
  3647. The mbtowc  function  converts a single multibyte character pointed to
  3648. by "s" into the wide character code that corresponds to that multibyte
  3649. character.  The code for the null character is zero.  If the multibyte
  3650. character is valid and "pwc" is not a NULL pointer, the code is stored
  3651. in the    object    pointed  to by    "pwc".    At most "n" bytes of the array
  3652. pointed to by "s" will be examined.
  3653. ::::MEMCCPY
  3654. #include \<string.h>
  3655. void *memccpy( void *dest, const void *src,
  3656.            int c, unsigned cnt );
  3657. void __far *_fmemccpy( void __far *dest,
  3658.                const void __far *src,
  3659.                int c, unsigned cnt );
  3660.  
  3661. The memccpy and _fmemccpy functions copy bytes from "src" to "dest" up
  3662. to and    including  the first  occurrence of the character "c" or until
  3663. "cnt" bytes have been copied, whichever comes first.
  3664.  
  3665. The _fmemccpy function is a data model independent form of the memccpy
  3666. function.  It accepts far pointer arguments and returns a far pointer.
  3667. It is most useful in mixed memory model applications.
  3668. ::::MEMCHR
  3669. #include \<string.h>
  3670. void *memchr( const void *buf,
  3671.           int ch,
  3672.           size_t length );
  3673. void __far *_fmemchr( const void __far *buf,
  3674.               int ch,
  3675.               size_t length );
  3676.  
  3677. The memchr and _fmemchr  functions locate the first occurrence of "ch"
  3678. (converted  to an unsigned  char) in the first    "length" characters of
  3679. the object pointed to by "buf".
  3680.  
  3681. The  _fmemchr  function is a data model independent form of the memchr
  3682. function.  It accepts far pointer arguments and returns a far pointer.
  3683. It is most useful in mixed memory model applications.
  3684. ::::MEMCMP
  3685. #include \<string.h>
  3686. int memcmp( const void *s1,
  3687.         const void *s2,
  3688.         size_t length );
  3689. int _fmemcmp( const void __far *s1,
  3690.           const void __far *s2,
  3691.           size_t length );
  3692.  
  3693. The  memcmp  and  _fmemcmp   functions     compare  the  first  "length"
  3694. characters  of the object  pointed to by "s1" to the object pointed to
  3695. by "s2".
  3696.  
  3697. The  _fmemcmp  function is a data model independent form of the memcmp
  3698. function  that    accepts far pointer  arguments.   It is most useful in
  3699. mixed memory model applications.
  3700. ::::MEMCPY
  3701. #include \<string.h>
  3702. void *memcpy( void *dst,
  3703.           const void *src,
  3704.           size_t length );
  3705. void __far *_fmemcpy( void __far *dst,
  3706.               const void __far *src,
  3707.               size_t length );
  3708.  
  3709. The memcpy and _fmemcpy  functions copy "length"  characters  from the
  3710. buffer    pointed  to by    "src"  into  the  buffer  pointed to by "dst".
  3711. Copying of  overlapping  objects is not  guaranteed  to work properly.
  3712. See the memmove function if you wish to copy objects that overlap.
  3713.  
  3714. The  _fmemcpy  function is a data model independent form of the memcpy
  3715. function.  It accepts far pointer arguments and returns a far pointer.
  3716. It is most useful in mixed memory model applications.
  3717. ::::MEMICMP
  3718. #include \<string.h>
  3719. int memicmp( const void *s1,
  3720.          const void *s2,
  3721.          size_t length );
  3722. int _fmemicmp( const void __far *s1,
  3723.            const void __far *s2,
  3724.            size_t length );
  3725.  
  3726. The memicmp and _fmemicmp  functions  compare, with case insensitivity
  3727. (upper- and lower-case    characters are equivalent), the first "length"
  3728. characters  of the object  pointed to by "s1" to the object pointed to
  3729. by "s2".
  3730.  
  3731. The _fmemicmp function is a data model independent form of the memicmp
  3732. function  that    accepts far pointer  arguments.   It is most useful in
  3733. mixed memory model applications.
  3734. ::::MEMMOVE
  3735. #include \<string.h>
  3736. void *memmove( void *dst,
  3737.            const void *src,
  3738.            size_t length );
  3739. void __far *_fmemmove( void __far *dst,
  3740.                const void __far *src,
  3741.                size_t length );
  3742.  
  3743. The memmove and _fmemmove  functions copy "length" characters from the
  3744. buffer    pointed to by "src" to the buffer pointed to by "dst". Copying
  3745. of  overlapping  objects will take place properly.   See the memcpy or
  3746. _fmemcpy functions to copy objects that do not overlap.
  3747.  
  3748. The _fmemmove function is a data model independent form of the memmove
  3749. function.  It accepts far pointer arguments and returns a far pointer.
  3750. It is most useful in mixed memory model applications.
  3751. ::::MEMORY
  3752.              Memory Manipulation Functions
  3753.              ═════════════════════════════
  3754.  
  3755. These  functions  manipulate  blocks  of  memory.   In    each case, the
  3756. address  of the  memory  block and its size is passed to the function.
  3757. The  functions    that  begin  with "_f"    accept far  pointers  as their
  3758. arguments  allowing  manipulation of any memory location regardless of
  3759. which memory model your program has been compiled for.     The following
  3760. functions are defined:
  3761.  
  3762. <_fmemccpy>    copy far memory block up to a certain character
  3763. <_fmemchr>    search far memory block for a character value
  3764. <_fmemcmp>    compare any two memory blocks (near or far)
  3765. <_fmemcpy>    copy far memory block, overlap not allowed
  3766. <_fmemicmp>    compare far memory, case insensitive
  3767. <_fmemmove>    copy far memory block, overlap allowed
  3768. <_fmemset>    set any memory block (near of far) to a character
  3769. <memccpy>    copy memory block up to a certain character
  3770. <memchr>    search memory block for a character value
  3771. <memcmp>    compare memory blocks
  3772. <memcpy>    copy memory block, overlap not allowed
  3773. <memicmp>    compare memory, case insensitive
  3774. <memmove>    copy memory block, overlap allowed
  3775. <memset>    set memory block to a character
  3776. <movedata>    copy memory block, with segment information
  3777. <swab>        swap bytes of a memory block
  3778.  
  3779. See also <string>  (string manipulation functions) for descriptions of
  3780. functions that manipulate strings of data.
  3781. ::::MEMSET
  3782. #include \<string.h>
  3783. void *memset( void *s,
  3784.           int c,
  3785.           size_t length );
  3786. void __far *_fmemset( void __far *s,
  3787.               int c,
  3788.               size_t length );
  3789.  
  3790. The memset and _fmemset  functions  fill the first "length" characters
  3791. of the object pointed to by "s" with the value "c".
  3792.  
  3793. The  _fmemset  function is a data model independent form of the memset
  3794. function.  It accepts far pointer arguments and returns a far pointer.
  3795. It is most useful in mixed memory model applications.
  3796. ::::MIN
  3797. #include \<stdlib.h>
  3798.  
  3799. The min  macro    will  evaluate to be the lesser of two values.     It is
  3800. implemented as follows.
  3801.  
  3802. #define min(a,b)  (((a) < (b)) ? (a) : (b))
  3803. ::::MISCELLANEOUS
  3804.             Miscellaneous Functions
  3805.             ═══════════════════════
  3806.  
  3807. The following functions are defined:
  3808.  
  3809. <assert>    test an assertion
  3810. <_fullpath>    return full path specification for file
  3811. <_harderr>    critical error handler
  3812. <_hardresume>    critical error handler resume
  3813. <localeconv>    obtain locale specific conversion information
  3814. <longjmp>    return and restore environment saved by setjmp
  3815. <_lrotl>    rotate an unsigned long left
  3816. <_lrotr>    rotate an unsigned long right
  3817. <main>        the main program (user written)
  3818. <offsetof>    get offset of field in structure
  3819. <_rotl>     rotate an unsigned int left
  3820. <_rotr>     rotate an unsigned int right
  3821. <setjmp>    save environment for use with longjmp function
  3822. <_makepath>    make a full filename from specified components
  3823. <setlocale>    set locale category
  3824. <_splitpath>    split a filename into its components
  3825. ::::MK_FP
  3826. #include \<dos.h>
  3827. void __far *MK_FP( unsigned int segment,
  3828.            unsigned int offset );
  3829.  
  3830. The MK_FP  macro can be used to obtain the far    pointer value given by
  3831. the  "segment"    segment  value and the "offset"  offset value.     These
  3832. values may be obtained by using the FP_SEG and FP_OFF macros.
  3833. ::::MKDIR
  3834. #include \<sys\types.h>
  3835. #include \<direct.h>
  3836. int mkdir( const char *path );
  3837.  
  3838. The mkdir  function  creates a new  subdirectory with name "path". The
  3839. "path" can be either  relative    to the current working directory or it
  3840. can be an absolute path name.
  3841. ::::MKTIME
  3842. #include \<time.h>
  3843. time_t mktime( struct tm *timeptr );
  3844.  
  3845. struct    tm {
  3846.   int tm_sec;    /* seconds after the minute -- [0,61] */
  3847.   int tm_min;    /* minutes after the hour   -- [0,59] */
  3848.   int tm_hour;    /* hours after midnight     -- [0,23] */
  3849.   int tm_mday;    /* day of the month        -- [1,31] */
  3850.   int tm_mon;    /* months since January     -- [0,11] */
  3851.   int tm_year;    /* years since 1900              */
  3852.   int tm_wday;    /* days since Sunday        -- [0,6]  */
  3853.   int tm_yday;    /* days since January 1     -- [0,365]*/
  3854.   int tm_isdst; /* Daylight Savings Time flag */
  3855. };
  3856.  
  3857. The  mktime  function  converts  the  local  time  information    in the
  3858. structure  pointed to by "timeptr"  into a calendar  time (Coordinated
  3859. Universal Time) with the same encoding used by the time function.  The
  3860. original  values of the fields    tm_sec,  tm_min, tm_hour, tm_mday, and
  3861. tm_mon are not restricted to ranges described for struct tm.  If these
  3862. fields are not in their  proper ranges, they are adjusted so that they
  3863. are in the proper ranges.    Values for the fields tm_wday and tm_yday
  3864. are computed after all the other fields have been adjusted.
  3865. ::::MODF
  3866. #include \<math.h>
  3867. double modf( double value, double *iptr );
  3868.  
  3869. The  modf  function  breaks  the  argument  "value" into  integral and
  3870. fractional parts, each of which has the same sign as the argument.  It
  3871. stores    the  integral  part  as a  double in the object  pointed to by
  3872. "iptr".
  3873. ::::MOVEDATA
  3874. #include \<string.h>
  3875. void movedata( unsigned int src_segment,
  3876.            unsigned int src_offset,
  3877.            unsigned int tgt_segment,
  3878.            unsigned int tgt_offset,
  3879.            size_t length );
  3880.  
  3881. The  movedata  function  copies  "length"  bytes  from the far pointer
  3882. calculated as (src_segment:src_offset) to a target location determined
  3883. as a far pointer (tgt_segment:tgt_offset).
  3884.  
  3885. Overlapping  data may not be  correctly  copied.   When the source and
  3886. target areas may overlap, copy the areas one character at a time.
  3887.  
  3888. The  function  is useful to move data when the near address(es) of the
  3889. source and/or target areas are not known.
  3890. ::::MULTIBYTE
  3891.              Multibyte Character Functions
  3892.              ═════════════════════════════
  3893.  
  3894. These ANSI C functions    provide  capabilities for processing multibyte
  3895. characters.  The following functions are defined:
  3896.  
  3897. <mblen>     determine length of next multibyte character
  3898. <mbstowcs>    convert  multibyte  character string to wide character
  3899.         string
  3900. <mbtowc>    convert multibyte character to wide character
  3901. <wcstombs>    convert wide character    string to multibyte  character
  3902.         string
  3903. <wctomb>    convert wide character to multibyte character
  3904. ::::NOSOUND
  3905. #include \<dos.h>
  3906. void nosound( void );
  3907.  
  3908. The nosound function turns off the PC's speaker.
  3909. ::::OFFSETOF
  3910. #include \<stddef.h>
  3911. size_t offsetof( composite, name );
  3912.  
  3913. The offsetof macro returns the offset of the element "name" within the
  3914. structure or union  "composite".  This    provides a portable  method to
  3915. determine the offset.     The macro may not be used to initialize data;
  3916. it can only be used with executable statements.
  3917. ::::ONEXIT
  3918. #include \<stdlib.h>
  3919. onexit_t onexit( onexit_t func )
  3920.  
  3921. The onexit  function  is passed the  address of  function "func" to be
  3922. called    when the program  terminates  normally.   Successive  calls to
  3923. onexit create a list of functions that will be executed on a "last-in,
  3924. first-out"  basis.   No more than 32  functions can be registered with
  3925. the onexit function.
  3926.  
  3927. The functions have no parameters and do not return values.
  3928.  
  3929. NOTE:  The onexit function is not an ANSI function.  The ANSI standard
  3930. function  atexit  does the same thing that  onexit  does and should be
  3931. used instead of onexit where ANSI portability is concerned.
  3932. ::::OPEN
  3933. #include \<sys\types.h>
  3934. #include \<sys\stat.h>
  3935. #include \<fcntl.h>
  3936. int open( const char *path, int access, ... );
  3937.  
  3938. The open  function  opens a file at the  operating system level.   The
  3939. name of the file to be    opened    is given by  "path".  The file will be
  3940. accessed  according  to the  access  mode  specified by "access".  The
  3941. optional  argument is the file permissions to be used when the O_CREAT
  3942. flag is on in the "access" mode.
  3943.  
  3944. The access  mode is  established  a combination of the bits defined in
  3945. \<fcntl.h> header file.  The following bits may be set:
  3946.  
  3947. O_RDONLY    permit the file to be only read.
  3948.  
  3949. O_WRONLY    permit the file to be only written.
  3950.  
  3951. O_RDWR        permit the file to be both read and written.
  3952.  
  3953. O_APPEND    causes  each  record  that is written to be written at the
  3954.         end of the file.
  3955.  
  3956. O_CREAT     has no  effect  when  the  file  indicated    by  "filename"
  3957.         already exists; otherwise, the file is created;
  3958.  
  3959. O_TRUNC     causes  the file to be  truncated  to contain no data when
  3960.         the  file  exists;    has no    effect    when the file does not
  3961.         exist.
  3962.  
  3963. O_BINARY    causes  the file to be  opened  in binary mode which means
  3964.         that  data    will  be  transmitted  to and  from  the  file
  3965.         unchanged.
  3966.  
  3967. O_TEXT        causes the file to be opened in text mode which means that
  3968.         carriage-return characters are written before any linefeed
  3969.         character  that  is  written  and  causes  carriage-return
  3970.         characters to be removed when encountered during reads.
  3971.  
  3972. When neither  O_TEXT nor O_BINARY are  specified, the default value in
  3973. the global  variable  _fmode is used to set the file translation mode.
  3974. When  the  program  begins  execution,    this  variable    has a value of
  3975. O_TEXT.
  3976.  
  3977. O_CREAT must be specified when the file does not exist and it is to be
  3978. written.
  3979.  
  3980. When the file is to be created ( O_CREAT is  specified), an additional
  3981. argument must be passed which contains the file permissions to be used
  3982. for the new file.   The access    permissions  for the file or directory
  3983. are  specified    as a  combination of bits (defined in the \<sys\stat.h>
  3984. header file).
  3985.  
  3986. The following bits define permissions for the owner.
  3987.  
  3988. S_IRWXU     Read, write, execute/search
  3989.  
  3990. S_IRUSR     Read permission
  3991.  
  3992. S_IWUSR     Write permission
  3993.  
  3994. S_IXUSR     Execute/search permission
  3995.  
  3996. The following bits define permissions for the group.
  3997.  
  3998. S_IRWXG     Read, write, execute/search
  3999.  
  4000. S_IRGRP     Read permission
  4001.  
  4002. S_IWGRP     Write permission
  4003.  
  4004. S_IXGRP     Execute/search permission
  4005.  
  4006. The following bits define permissions for others.
  4007.  
  4008. S_IRWXO     Read, write, execute/search
  4009.  
  4010. S_IROTH     Read permission
  4011.  
  4012. S_IWOTH     Write permission
  4013.  
  4014. S_IXOTH     Execute/search permission
  4015.  
  4016. The  following    bits define  miscellaneous  permissions  used by other
  4017. implementations.
  4018.  
  4019. S_IREAD     is equivalent to S_IRUSR (read permission)
  4020.  
  4021. S_IWRITE    is equivalent to S_IWUSR (write permission)
  4022.  
  4023. S_IEXEC     is equivalent to S_IXUSR (execute/search permission)
  4024.  
  4025. All  files  are  readable  with DOS; however, it is a good idea to set
  4026. S_IREAD when read permission is intended for the file.
  4027.  
  4028. The  open  function  applies the current file  permission  mask to the
  4029. specified permissions (see umask).
  4030. ::::OPENDIR
  4031. #include \<sys\types.h>
  4032. #include \<direct.h>
  4033. DIR *opendir( const char *dirname );
  4034.  
  4035. The opendir function is used in conjunction with the functions readdir
  4036. and  closedir  to  obtain  the    list  of file names  contained    in the
  4037. directory  specified by "dirname". The path indicated by "dirname" can
  4038. be either  relative  to the  current working directory or it can be an
  4039. absolute  path    name.    The last part of  "dirname"  can  contain  the
  4040. characters '?' and '*' for matching multiple files.
  4041.  
  4042. The file \<direct.h> contains definitions for the structure dirent.
  4043.  
  4044. typedef struct dirent {
  4045.     char    d_dta[ 21 ];       /* disk transfer area */
  4046.     char    d_attr;           /* file's attribute */
  4047.     unsigned short int d_time; /* file's time */
  4048.     unsigned short int d_date; /* file's date */
  4049.     long    d_size;           /* file's size */
  4050.     char    d_name[ 13 ];      /* file's name */
  4051.     ino_t   d_ino;           /* serial number */
  4052.     char    d_first;           /* flag for 1st time */
  4053. } DIR;
  4054.  
  4055. More  than  one  directory  can  be read at the same  time  using  the
  4056. opendir, readdir, and closedir functions.
  4057. ::::OPERATING
  4058.             Operating System I/O Functions
  4059.             ══════════════════════════════
  4060.  
  4061. These functions operate at the operating-system level and are included
  4062. for  compatibility  with other C  implementations.   It is recommended
  4063. that the  functions used in the section File Manipulation Functions be
  4064. used for new programs, as these functions are defined portably and are
  4065. part of the ANSI standard for the C language.
  4066.  
  4067. The functions in this section reference opened files and devices using
  4068. a file    handle    which is  returned when the file is opened.   The file
  4069. handle is passed to the other functions.
  4070.  
  4071. The following functions are defined:
  4072.  
  4073. <chsize>    change the size of a file
  4074. <close>     close file
  4075. <creat>     create a file
  4076. <dup>        duplicate file handle, get unused handle number
  4077. <dup2>        duplicate file handle, supply new handle number
  4078. <eof>        test for end of file
  4079. <filelength>    get file size
  4080. <fileno>    get file handle for stream file
  4081. <fstat>     get file status
  4082. <lock>        lock a section of a file
  4083. <locking>    lock/unlock a section of a file
  4084. <lseek>     set current file position
  4085. <open>        open a file
  4086. <read>        read a record
  4087. <setmode>    set file mode
  4088. <sopen>     open a file for shared access
  4089. <tell>        get current file position
  4090. <umask>     set file permission mask
  4091. <unlink>    delete a file
  4092. <unlock>    unlock a section of a file
  4093. <write>     write a record
  4094. ::::OUTP
  4095. #include \<conio.h>
  4096. unsigned int outp( int port, int value );
  4097.  
  4098. The  outp  function  writes  one byte,    determined  by "value," to the
  4099. hardware port whose number is given by "port".
  4100.  
  4101. A  hardware  port is used to  communicate  with a device.   One or two
  4102. bytes can be read  and/or  written  from each port, depending upon the
  4103. hardware.   Consult the technical  documentation  for your computer to
  4104. determine the port numbers for a device and the expected usage of each
  4105. port for a device.
  4106. ::::OUTPW
  4107. #include \<conio.h>
  4108. unsigned int outpw( int port,
  4109.             unsigned int value );
  4110.  
  4111. The outpw  function  writes a word (two bytes), determined by "value,"
  4112. to the hardware port whose number is given by "port".
  4113.  
  4114. A  hardware  port is used to  communicate  with a device.   One or two
  4115. bytes can be read  and/or  written  from each port, depending upon the
  4116. hardware.   Consult the technical  documentation  for your computer to
  4117. determine the port numbers for a device and the expected usage of each
  4118. port for a device.
  4119. ::::PERROR
  4120. #include \<stdio.h>
  4121. void perror( const char *prefix );
  4122.  
  4123. The  perror  function  prints, on the file  designated    by stderr, the
  4124. error  message    corresponding  to the error number contained in errno.
  4125. The perror function is implemented as follows:
  4126.  
  4127. #include \<stdio.h>
  4128. void perror( const char *prefix )
  4129. {
  4130.     if( prefix != NULL ) {
  4131.     if( *prefix != '\0' ) {
  4132.         fprintf( stderr, "%s: ", prefix );
  4133.     }
  4134.     }
  4135.     fprintf( stderr, "%s\n", strerror( errno ) );
  4136. }
  4137. ::::POW
  4138. #include \<math.h>
  4139. double pow( double x, double y );
  4140.  
  4141. The pow  function computes "x" raised to the power "y". A domain error
  4142. occurs if "x" is zero and "y" is less than or equal to 0, or if "x" is
  4143. negative and "y" is not an integer.  A range error may occur.
  4144. ::::PRINTF
  4145. #include \<stdio.h>
  4146. int printf( const char *format, ... );
  4147.  
  4148. The printf  function  writes  output to the file  designated by stdout
  4149. under control of the argument "format".
  4150.  
  4151. Format Control String:
  4152.  
  4153. The format control string  consists of ordinary  characters, that are
  4154. written  exactly as they occur in the format  string,  and conversion
  4155. specifiers,  that  cause  argument  values  to be written as they are
  4156. encountered during the processing of the format string.   An ordinary
  4157. character in the format string is any character, other than a percent
  4158. character  (%),  that  is not  part of a  conversion  specifier.    A
  4159. conversion specifier is a sequence of characters in the format string
  4160. that  begins  with  a  percent    character  (%)    and is    followed,  in
  4161. sequence, by the following:
  4162.  
  4163.    * zero  or  more  format  control  flags that can modify the final
  4164.     effect of the format directive
  4165.  
  4166.    * an optional  decimal  integer, or an asterisk  character  ('*'),
  4167.     that  specifies  a minimum    field  width to be  reserved  for the
  4168.     formatted item
  4169.  
  4170.    * an  optional  precision  specification  in the  form of a period
  4171.     character  (.),  followed  by an optional  decimal    integer or an
  4172.     asterisk character (*)
  4173.  
  4174.    * an optional  type length  specification:    one of "h", "l", "L",
  4175.     "N" or "F"
  4176.  
  4177.    * a    character  that  specifies  the  type  of  conversion  to  be
  4178.     performed:    one of the characters "cdeEfFgGinopsuxX".
  4179.  
  4180. The valid format control flags are:
  4181.  
  4182. "-"  the formatted item is left-justified within the field; normally,
  4183.      items are right-justified
  4184.  
  4185. "+"  a    signed,  positive  object  will  always  start    with  a  plus
  4186.      character (+); normally, only negative items begin with a sign
  4187.  
  4188. " "  a    signed,  positive  object  will  always  start    with a    space
  4189.      character; if both "+" and "-" are specified, "+" overrides "-"
  4190.  
  4191. "#"  an alternate conversion form is used:
  4192.  
  4193.     * for "o"  (unsigned  octal)  conversions,  the  precision is
  4194.      incremented, if necessary, so that the first digit is "0".
  4195.  
  4196.     * for  "x"  or    "X"  (unsigned    hexadecimal)  conversions,  a
  4197.      non-zero value is prepended with "0x" or "0X" respectively
  4198.  
  4199.     * for  "e",  "E",  "f",  "g"  or  "G"  (any  floating  point)
  4200.      conversions,  the  result  always  contains a    decimal-point
  4201.      character,   even  if    no  digits  follow  it;  normally,  a
  4202.      decimal-point    character appears in the result only if there
  4203.      is a digit to follow it
  4204.  
  4205.     * in  addition    to the preceding, for "g" or "G" conversions,
  4206.      trailing zeros are not removed from the result
  4207.  
  4208. If no field width is specified, or if the value that is given is less
  4209. than the number of  characters in the converted value (subject to any
  4210. precision  value),  a  field  of  sufficient  width  to  contain  the
  4211. converted value is used.  If the converted value has fewer characters
  4212. than  are  specified  by the field  width, the value is padded on the
  4213. left (or right,  subject to the  left-justification flag) with spaces
  4214. or zero characters ("0").  If the field width begins with a zero, the
  4215. value  is  padded  with  zeros,  otherwise  the value is padded  with
  4216. spaces.   If  the  field  width  is "*", a value of type int from the
  4217. argument  list is used    (before a  precision argument or a conversion
  4218. argument) as the minimum field width.     A negative field width value
  4219. is  interpreted  as a left-justification flag, followed by a positive
  4220. field width.
  4221.  
  4222. As  with  the  field  width  specifier, a precision  specifier of "*"
  4223. causes a value of type int from the  argument  list to be used as the
  4224. precision specifier.   If no precision value is given, a precision of
  4225. 0 is used.  The precision value affects the following conversions:
  4226.  
  4227.    * for "d", "i", "o", "u", "x" and "X"  (integer)  conversions, the
  4228.     precision specifies the minimum number of digits to appear
  4229.  
  4230.    * for   "e",   "E"  and  "f"   (fixed-precision,   floating-point)
  4231.     conversions,  the  precision  specifies  the  number of digits to
  4232.     appear after the decimal-point character
  4233.  
  4234.    * for   "g"     and   "G"    (variable-precision,    floating-point)
  4235.     conversions,  the  precision  specifies  the  maximum  number  of
  4236.     significant digits to appear
  4237.  
  4238.    * for  "s"  (string)  conversions,  the  precision  specifies  the
  4239.     maximum number of characters to appear
  4240.  
  4241. A type length specifier affects the conversion as follows:
  4242.  
  4243.    * "h" causes a "d", "i", "o", "u", "x" or "X" (integer) conversion
  4244.     to process a short int or  unsigned short int argument; note that
  4245.     although  the  argument  may  have been  promoted  as part of the
  4246.     function  call, the value is converted to the smaller type before
  4247.     it is converted
  4248.  
  4249.    * "h"  causes an "n" (converted  length  assignment)  operation to
  4250.     assign the    converted  length to an object of type unsigned short
  4251.     int
  4252.  
  4253.    * "l" causes a "d", "i", "o", "u", "x" or "X" (integer) conversion
  4254.     to process a long int or unsigned long int argument;
  4255.  
  4256.    * "l"  causes an "n" (converted  length  assignment)  operation to
  4257.     assign the    converted  length to an object of type    unsigned long
  4258.     int
  4259.  
  4260.    * "F" causes the pointer associated with "n", "p", "s" conversions
  4261.     to be treated as a far pointer;
  4262.  
  4263.    * "L"  causes an "e", "E", "f", "g", "G"  (double)  conversion  to
  4264.     process a long double argument;
  4265.  
  4266.    * "N" causes the pointer associated with "n", "p", "s" conversions
  4267.     to be treated as a near pointer;
  4268.  
  4269. The valid conversion type specifiers are:
  4270.  
  4271. c    An argument of type int is converted to a value of type char and
  4272.      the  corresponding ASCII character code is written to the output
  4273.      stream.
  4274.  
  4275. d, i An  argument  of  type  int is  converted    to a  signed  decimal
  4276.      notation  and  written  to  the  output  stream.     The  default
  4277.      precision    is 1, but if more  digits are required, leading zeros
  4278.      are added.
  4279.  
  4280. e, E An argument of type double is converted to a decimal notation in
  4281.      the form  [-]d.ddde[+|-]ddd  similar to FORTRAN  exponential (E)
  4282.      notation.     The  leading  sign  appears  (subject    to the format
  4283.      control  flags)  only  if the  argument  is  negative.    If the
  4284.      argument  is  non-zero,   the  digit  before  the    decimal-point
  4285.      character is non-zero.    The precision is used as the number of
  4286.      digits following the decimal-point character.   If the precision
  4287.      is not  specified,  a default precision of six is used.   If the
  4288.      precision is 0, the decimal-point character is suppressed.   The
  4289.      value is rounded to the appropriate number of digits.    For "E"
  4290.      conversions,  the exponent  begins with the character "E" rather
  4291.      than "e".     The  exponent    sign and a  three-digit  number (that
  4292.      indicates    the  power of ten by which the    decimal  fraction  is
  4293.      multiplied) are always produced.
  4294.  
  4295. f    An argument of type double is converted to a decimal notation in
  4296.      the form [-]ddd.ddd similar to FORTRAN fixed-point (F) notation.
  4297.      The leading sign appears  (subject to the format  control flags)
  4298.      only if the argument is negative.     The precision is used as the
  4299.      number of digits following the decimal-point character.   If the
  4300.      precision    is not specified, a default precision of six is used.
  4301.      If  the   precision  is  0,  the    decimal-point    character  is
  4302.      suppressed, otherwise, at least one digit is produced before the
  4303.      decimal-point   character.    The     value     is  rounded  to  the
  4304.      appropriate number of digits.
  4305.  
  4306. g, G An  argument of type double is converted using either the "f" or
  4307.      "e" (or "E", for a "G" conversion) style of conversion depending
  4308.      on the value of the  argument.   In either  case, the  precision
  4309.      specifies the number of significant digits that are contained in
  4310.      the result.    "e" style conversion is used only if the exponent
  4311.      from such a conversion would be less than -4 or greater than the
  4312.      precision.   Trailing  zeros are  removed    from the result and a
  4313.      decimal-point  character  only  appears if it is  followed  by a
  4314.      digit.
  4315.  
  4316. n    The number of  characters    that have been    written to the output
  4317.      stream is    assigned  to the  integer pointed to by the argument.
  4318.      No output is produced.
  4319.  
  4320. o    An  argument  of  type int is  converted  to an  unsigned    octal
  4321.      notation  and  written  to  the  output  stream.     The  default
  4322.      precision    is 1, but if more  digits are required, leading zeros
  4323.      are added.
  4324.  
  4325. p, P An  argument  of type void * is converted to a value of type int
  4326.      and  the  value  is   formatted   as  for    a  hexadecimal    ("x")
  4327.      conversion.
  4328.  
  4329. s    Characters from the string specified by an argument of type char
  4330.      *, up to,    but not  including  the  terminating  null  character
  4331.      ("\0"),  are  written to the output  stream.   If a precision is
  4332.      specified, no more than that many characters are written.
  4333.  
  4334. u    An  argument  of type int is  converted  to an  unsigned decimal
  4335.      notation  and  written  to  the  output  stream.     The  default
  4336.      precision    is 1, but if more  digits are required, leading zeros
  4337.      are added.
  4338.  
  4339. x, X An  argument of type int is converted to an unsigned hexadecimal
  4340.      notation  and  written  to  the  output  stream.     The  default
  4341.      precision    is 1, but if more  digits are required, leading zeros
  4342.      are added.  Hexadecimal notation uses the digits "0" through "9"
  4343.      and the characters "a" through "f" or "A" through "F" for "x" or
  4344.      "X"  conversions    respectively,  as  the    hexadecimal   digits.
  4345.      Subject  to the  alternate-form  control  flag,  "0x" or "0X" is
  4346.      prepended to the output.
  4347.  
  4348. Any  other  conversion type specifier  character,  including  another
  4349. percent  character  (%),  is  written  to the output  stream  with no
  4350. special interpretation.
  4351.  
  4352. The arguments must  correspond    with the conversion  type specifiers,
  4353. left to right in the string;  otherwise,  indeterminate  results will
  4354. occur.
  4355.  
  4356. For  example, a  specifier of the form "%8.*f" will define a field to
  4357. be at least 8 characters wide, and will get the next argument for the
  4358. precision to be used in the conversion.
  4359.  
  4360. The output from
  4361.  
  4362. printf( "f1 = %8.4f f2 = %10.2E x = %#08x i = %d",
  4363.     23.45,        3141.5926,     0x1db,     -1 );
  4364.  
  4365. would be
  4366.  
  4367. f1 =  23.4500 f2 =  3.14E+003 x = 0x0001db i = -1
  4368. ::::PROCESS
  4369.               Process Primitive Functions
  4370.               ═══════════════════════════
  4371.  
  4372. These functions deal with process creation, execution and termination,
  4373. and signal handling.
  4374.  
  4375. When a new process is started, it may replace the existing process
  4376.  
  4377.    * P_OVERLAY is specified with the spawn...  functions
  4378.  
  4379.    * the exec...  routines are invoked
  4380.  
  4381. or the    existing  process  may be  suspended  while  the  new  process
  4382. executes (control continues at the point following the place where the
  4383. new process was started)
  4384.  
  4385.    * P_WAIT is specified with the spawn...  functions
  4386.  
  4387.    * system is used
  4388.  
  4389. The following functions are defined:
  4390.  
  4391. <abort>     immediate termination of process, return code 3
  4392. <atexit>    register exit routine
  4393. <_beginthread>    start a new thread of execution
  4394. <cwait>     wait for a child process to terminate
  4395. <delay>     delay for number of milliseconds
  4396. <_endthread>    end the current thread
  4397. <execl>     chain to program
  4398. <execle>    chain to program, pass environment
  4399. <execlp>    chain to program
  4400. <execlpe>    chain to program, pass environment
  4401. <execv>     chain to program
  4402. <execve>    chain to program, pass environment
  4403. <execvp>    chain to program
  4404. <execvpe>    chain to program, pass environment
  4405. <exit>        exit process, set return code
  4406. <_exit>     exit process, set return code
  4407. <onexit>    register exit routine
  4408. <raise>     signal an exceptional condition
  4409. <signal>    set handling for exceptional condition
  4410. <sleep>     delay for number of seconds
  4411. <spawnl>    create process
  4412. <spawnle>    create process, set environment
  4413. <spawnlp>    create process
  4414. <spawnlpe>    create process, set environment
  4415. <spawnv>    create process
  4416. <spawnve>    create process, set environment
  4417. <spawnvp>    create process
  4418. <spawnvpe>    create process, set environment
  4419. <system>    execute system command
  4420. <wait>        wait for any child process to terminate
  4421.  
  4422. There are eight spawn...    and exec...  functions each.  The "..." is
  4423. one to three letters:
  4424.  
  4425.    * "l" or "v" (one is  required)  to    indicate  the way the  process
  4426.     parameters are passed
  4427.  
  4428.    * "p" (optional) to indicate  whether the PATH environment variable
  4429.     is searched to locate the program for the process
  4430.  
  4431.    * "e"  (optional)  to indicate that the  environment  variables are
  4432.     being passed
  4433. ::::PUTC
  4434. #include \<stdio.h>
  4435. int putc( int c, FILE *fp );
  4436.  
  4437. The putc function is equivalent to fputc, except it may be implemented
  4438. as a macro.    The putc function writes the character specified by the
  4439. argument "c" to the output stream designated by "fp".
  4440. ::::PUTCH
  4441. #include \<conio.h>
  4442. int putch( int c );
  4443.  
  4444. The putch  function writes the character specified by the argument "c"
  4445. to the console.
  4446. ::::PUTCHAR
  4447. #include \<stdio.h>
  4448. int putchar( int c );
  4449.  
  4450. The putchar  function  writes the  character specified by the argument
  4451. "c" to the output stream stdout.
  4452.  
  4453. The function is equivalent to
  4454.  
  4455. fputc( c, stdout );
  4456. ::::PUTENV
  4457. #include \<process.h>
  4458. int putenv( const char *env_name );
  4459.  
  4460. The  environment  list consists of a number of environment names, each
  4461. of which has a value associated with it.   Entries can be added to the
  4462. environment list with the DOS set command or with the putenv function.
  4463. All  entries in the environment list can be displayed by using the DOS
  4464. set command with no arguments.     A program can obtain the value for an
  4465. environment variable by using the getenv function.
  4466.  
  4467. When the value of "env_name" has the format
  4468.  
  4469.     env_name=value
  4470.  
  4471. an  environment  name and its value is added to the  environment list.
  4472. When the value of "env_name" has the format
  4473.  
  4474.     env_name=
  4475.  
  4476. the environment name and value is removed from the environment list.
  4477.  
  4478. The matching is  case-insensitive;  all lower-case letters are treated
  4479. as if they were in upper case.
  4480.  
  4481. The space into which  environment names and their values are placed is
  4482. limited.   Consequently,  the  putenv  function can fail when there is
  4483. insufficient space remaining to store an additional value.
  4484.  
  4485. NOTE:    If the argument "env_name" is not a literal string, you should
  4486. duplicate  the    string,  since    putenv    does  not  copy the value; for
  4487. example,
  4488.  
  4489.     putenv( strdup( buffer ) );
  4490.  
  4491. To assign a string to a variable and place it in the environment list:
  4492.  
  4493.     C>SET INCLUDE=C:\WATCOM\H
  4494.  
  4495. To see what  variables    are in the environment list, and their current
  4496. assignments:
  4497.  
  4498.     C>SET
  4499.     COMSPEC=C:\COMMAND.COM
  4500.     PATH=C:\;C:\WATCOM
  4501.     INCLUDE=C:\WATCOM\H
  4502.  
  4503.     C>
  4504. ::::PUTS
  4505. #include \<stdio.h>
  4506. int puts( const char *buf );
  4507.  
  4508. The puts  function  writes the character string pointed to by "buf" to
  4509. the  output  stream  designated  by  stdout,  and  appends  a new-line
  4510. character  to the  output.   The  terminating  null  character    is not
  4511. written.
  4512. ::::QSORT
  4513. #include \<stdlib.h>
  4514. void qsort( void *base,
  4515.         size_t num,
  4516.         size_t width,
  4517.         int (*compar)
  4518.          ( const void *, const void *) );
  4519.  
  4520. The qsort  function sorts an array of "num" elements, which is pointed
  4521. to by "base," using Hoare's Quicksort algorithm.   Each element in the
  4522. array is "width" bytes in size.  The comparison function pointed to by
  4523. "compar"  is called  with two  arguments that point to elements in the
  4524. array.     The  comparison  function  shall return an integer less than,
  4525. equal  to, or greater  than zero if the first  argument  is less than,
  4526. equal to, or greater than the second argument.
  4527. ::::RAISE
  4528. #include \<signal.h>
  4529. int raise( int condition );
  4530.  
  4531. The raise function  signals the exceptional condition indicated by the
  4532. "condition"  argument.     The  possible    conditions  are defined in the
  4533. \<signal.h>  header file and are  documented  with the signal function.
  4534. The signal function can be used to specify the action which is to take
  4535. place when such a condition occurs.
  4536. ::::RAND
  4537. #include \<stdlib.h>
  4538. int rand( void );
  4539.  
  4540. The rand function computes a sequence of pseudo-random integers in the
  4541. range 0 to RAND_MAX (32767).  The sequence can be started at different
  4542. values by calling the srand function.
  4543. ::::READ
  4544. #include \<io.h>
  4545. int read( int handle, char *buffer, int len );
  4546.  
  4547. The read  function  reads data at the  operating  system  level.   The
  4548. number    of  bytes  transmitted    is  given  by  "len"  and  the data is
  4549. transmitted starting at the address specified by "buffer".
  4550.  
  4551. The "handle" value is returned by the open function.   The access mode
  4552. must have  included  either  O_RDONLY or O_RDWR when the open function
  4553. was invoked.    The data is read starting at the current file position
  4554. for the file in question.    This file position can be determined with
  4555. the tell function and can be set with the lseek function.
  4556.  
  4557. When  O_BINARY is included in the access mode, the data is transmitted
  4558. unchanged.   When  O_TEXT is  included in the access mode, the data is
  4559. transmitted  with the extra carriage  return  character removed before
  4560. each linefeed character encountered in the original data.
  4561. ::::READDIR
  4562. #include \<sys\types.h>
  4563. #include \<direct.h>
  4564. struct dirent *readdir( DIR *dirp );
  4565.  
  4566. The readdir  function obtains information about the next matching file
  4567. name  from  the  argument  "dirp".  The  argument  "dirp" is the value
  4568. returned  from    the  opendir  function.   The readdir  function can be
  4569. called    repeatedly  to obtain the list of file names  contained in the
  4570. directory  specified by the pathname  given to opendir.   The function
  4571. closedir  must    be called to close the    directory  and free the memory
  4572. allocated by opendir.
  4573.  
  4574. The file \<direct.h> contains definitions for the structure dirent.
  4575.  
  4576. typedef struct dirent {
  4577.     char    d_dta[ 21 ];       /* disk transfer area */
  4578.     char    d_attr;           /* file's attribute */
  4579.     unsigned short int d_time; /* file's time */
  4580.     unsigned short int d_date; /* file's date */
  4581.     long    d_size;           /* file's size */
  4582.     char    d_name[ 13 ];      /* file's name */
  4583.     ino_t   d_ino;           /* serial number */
  4584.     char    d_first;           /* flag for 1st time */
  4585. } DIR;
  4586.  
  4587. ::::REALLOC
  4588. #include \<stdlib.h>
  4589. void * realloc( void *old_blk, size_t size );
  4590.  
  4591. When  the  value  of the  "old_blk"  argument  is NULL, a new block of
  4592. memory of "size" bytes is allocated.
  4593.  
  4594. If the value of "size" is zero,  realloc  calls the free  function  to
  4595. release the memory pointed to by "old_blk".
  4596.  
  4597. Otherwise,  the realloc  function  re-allocates space for an object of
  4598. "size" bytes by either:
  4599.  
  4600.    * shrinking    the  allocated    size  of the  allocated  memory  block
  4601.     "old_blk"  when  "size" is    sufficiently  smaller than the size of
  4602.     "old_blk".
  4603.  
  4604.    * extending    the  allocated    size  of the  allocated  memory  block
  4605.     "old_blk"  if there is a large  enough block of unallocated memory
  4606.     immediately following "old_blk".
  4607.  
  4608.    * allocating  a new block and  copying the contents of "old_blk" to
  4609.     the new block.
  4610.  
  4611. Because it is  possible  that a new block will be  allocated, no other
  4612. pointers  should point into the memory of  "old_blk".  These  pointers
  4613. will point to freed  memory, with  possible disastrous results, when a
  4614. new block is allocated.
  4615.  
  4616. The  memory  pointed  to by  "old_blk"    is not    freed  if it cannot be
  4617. re-allocated.
  4618.  
  4619. In a small data  memory  model, the  realloc function is equivalent to
  4620. the  _nrealloc    function;  in a  large data memory  model, the realloc
  4621. function is equivalent to the _frealloc function.
  4622. ::::REMOVE
  4623. #include \<stdio.h>
  4624. int remove( const char *filename );
  4625.  
  4626. The remove  function deletes the file whose name is the string pointed
  4627. to by "filename".
  4628. ::::RENAME
  4629. #include \<stdio.h>
  4630. int rename( const char *old, const char *new );
  4631.  
  4632. The rename  function  causes the file whose name is  indicated    by the
  4633. string "old" to be renamed to the name given by the string "new".
  4634. ::::REWIND
  4635. #include \<stdio.h>
  4636. void rewind( FILE *fp );
  4637.  
  4638. The rewind  function  sets the file  position indicator for the stream
  4639. indicated to by "fp" to the beginning of the file.    It is equivalent
  4640. to
  4641.  
  4642.     fseek( fp, 0L, SEEK_SET );
  4643.  
  4644. except that the error indicator for the stream is cleared.
  4645. ::::RMDIR
  4646. #include \<sys\types.h>
  4647. #include \<direct.h>
  4648. int rmdir( const char *path );
  4649.  
  4650. The rmdir function  removes  (deletes) the specified  directory.   The
  4651. directory must not contain any files or directories.    The "path" can
  4652. be either  relative  to the  current working directory or it can be an
  4653. absolute path name.
  4654. ::::SBRK
  4655. #include \<stdlib.h>
  4656. void *sbrk( int increment );
  4657.  
  4658. The sbrk sets the "break" value for the program by adding the value of
  4659. "increment"  to the  current  break  value.    This  increment    may be
  4660. positive or negative.
  4661.  
  4662. The  "break"  value  is the  address of the first byte of  unallocated
  4663. memory.   When a program  starts  execution, the break value is placed
  4664. following  the code and  constant data for the program.   As memory is
  4665. allocated,  this  pointer  will  advance  when there is no freed block
  4666. large enough to satisfy an allocation request.
  4667.  
  4668. A new process started with one of the spawn...     or exec...  functions
  4669. is  loaded  following the break value.     Consequently,    decreasing the
  4670. break    value    leaves    more  space  available    to  the  new  process.
  4671. Similarly,  for a resident  program (a program which remains in memory
  4672. while another program executes), increasing the break value will leave
  4673. more  space  available to be allocated by the resident    program  after
  4674. other programs are loaded.
  4675. ::::SCANF
  4676. #include \<stdio.h>
  4677. int scanf( const char *format, ... );
  4678.  
  4679. The scanf function scans input from the file designated by stdin under
  4680. control of the argument  "format".  Following the format string is the
  4681. list of addresses of items to receive values.
  4682. ::::SEARCHING
  4683.               Searching Functions
  4684.               ═══════════════════
  4685.  
  4686. These  functions  provide  searching  and sorting  capabilities.   The
  4687. following functions are defined:
  4688.  
  4689. <bsearch>    find a data item in an array using binary search
  4690. <lfind>     find a data item in an array using linear search
  4691. <lsearch>    linear search array, add item if not found
  4692. <qsort>     sort an array
  4693. ::::SEGREAD
  4694. #include \<dos.h>
  4695. void segread( struct SREGS *seg_regs );
  4696.  
  4697. The segread  function  places the values of the segment registers into
  4698. the structure located by "seg_regs".
  4699. ::::SETBUF
  4700. #include \<stdio.h>
  4701. void setbuf( FILE *fp, char *buffer );
  4702.  
  4703. The setbuf  function  can be used to  associate a buffer with the file
  4704. designated  by "fp". If this function is used, it must be called after
  4705. the file has been opened and before it has been read or written.    If
  4706. the argument "buffer" is NULL, then all input/output for the file "fp"
  4707. will be completely unbuffered.     If the argument "buffer" is not NULL,
  4708. then it must point to an array that is at least  BUFSIZ  characters in
  4709. length, and all input/output will be fully buffered.
  4710. ::::SETENV
  4711. #include \<env.h>
  4712. int setenv( const char *name,
  4713.         const char *newvalue,
  4714.         int overwrite );
  4715.  
  4716. The  environment  list consists of a number of environment names, each
  4717. of which has a value associated with it.   Entries can be added to the
  4718. environment list with the DOS set command or with the setenv function.
  4719. All  entries in the environment list can be displayed by using the DOS
  4720. set command with no arguments.     A program can obtain the value for an
  4721. environment variable by using the getenv function.
  4722.  
  4723. The setenv  function searches the environment list for an entry of the
  4724. form  "name=value". If no such string is present, setenv adds an entry
  4725. of the form  "name=newvalue"  to the environment list.     Otherwise, if
  4726. the  "overwrite"  argument is non-zero,  setenv either will change the
  4727. existing  value to  "newvalue"    or will delete the string "name=value"
  4728. and add the string "name=newvalue".
  4729.  
  4730. If  the   "newvalue"   pointer    is  NULL,  all    strings  of  the  form
  4731. "name=value" in the environment list will be deleted.
  4732.  
  4733. The  value  of the  pointer  environ  may change  across a call to the
  4734. setenv function.
  4735.  
  4736. The setenv  function  will make copies of the strings  associated with
  4737. "name" and "newvalue".
  4738.  
  4739. The matching is  case-insensitive;  all lower-case letters are treated
  4740. as  if    they  were in upper  case.   Entries  can also be added to the
  4741. environment list with the DOS set command or with the putenv or setenv
  4742. functions.   All  entries in the  environment  list can be obtained by
  4743. using the getenv function.
  4744.  
  4745. To assign a string to a variable and place it in the environment list:
  4746.  
  4747.     C>SET INCLUDE=C:\WATCOM\H
  4748.  
  4749. To see what  variables    are in the environment list, and their current
  4750. assignments:
  4751.  
  4752.     C>SET
  4753.     COMSPEC=C:\COMMAND.COM
  4754.     PATH=C:\;C:\WATCOM
  4755.     INCLUDE=C:\WATCOM\H
  4756.  
  4757.     C>
  4758. ::::SETJMP
  4759. #include \<setjmp.h>
  4760. int setjmp( jmp_buf env );
  4761.  
  4762. The  setjmp  function  saves  its calling  environment    in its jmp_buf
  4763. argument, for subsequent use by the longjmp function.
  4764.  
  4765. In some  cases,  error    handling can be implemented by using setjmp to
  4766. record    the  point to which a return  will occur  following  an error.
  4767. When an error is  detected  in a called  function,  that function uses
  4768. longjmp to jump back to the recorded position.     The original function
  4769. which  called  setjmp must still be active (it cannot have returned to
  4770. the function which called it).
  4771.  
  4772. Special  care must be  exercised  to ensure that any side effects that
  4773. are  left  undone   (allocated     memory,   opened   files,  etc.)  are
  4774. satisfactorily handled.
  4775. ::::SETLOCALE
  4776. #include \<locale.h>
  4777. char *setlocale( int category, const char *locale );
  4778.  
  4779. The  setlocale    function  selects  a  portion  of a  program's  locale
  4780. according to the category given by "category" and the locale specified
  4781. by "locale". A locale  affects the  collating  sequence  (the order in
  4782. which  characters  compare with one another), the way in which certain
  4783. character-handling functions operate, the decimal-point character that
  4784. is  used  in formatted    input/output  and string  conversion,  and the
  4785. format    and names used in the time  string  produced  by the  strftime
  4786. function.
  4787.  
  4788. Potentially, there may be many such environments.    WATCOM C supports
  4789. only the "C" locale and so  invoking this function will have no effect
  4790. upon the behavior of a program at present.
  4791.  
  4792. The possible values for the argument "category" are as follows:
  4793.  
  4794. LC_ALL           select entire environment
  4795.  
  4796. LC_COLLATE     select collating sequence
  4797.  
  4798. LC_CTYPE       select the character-handling
  4799.  
  4800. LC_MONETARY    select monetary formatting information
  4801.  
  4802. LC_NUMERIC     select the numeric-format environment
  4803.  
  4804. LC_TIME        select the time-related environment
  4805.  
  4806. At the start of a program,  the  equivalent of the following statement
  4807. is executed.
  4808.  
  4809.     setlocale( LC_ALL, "C" );
  4810.  
  4811. ::::SETMODE
  4812. #include \<io.h>
  4813. #include \<fcntl.h>
  4814. int setmode( int handle, int mode );
  4815.  
  4816. The  setmode  function    sets,  at  the    operating  system  level,  the
  4817. translation  mode to be the  value of  "mode"  for the file whose file
  4818. handle is given by "handle". The mode, defined in the \<fcntl.h> header
  4819. file, can be one of:
  4820.  
  4821. O_TEXT      On  input,  a  carriage-return  character  that  immediately
  4822.       precedes a linefeed  character is removed from the data that
  4823.       is read.  On output, a carriage-return character is inserted
  4824.       before each linefeed character.
  4825.  
  4826. O_BINARY  Data is read or written unchanged.
  4827. ::::SETVBUF
  4828. #include \<stdio.h>
  4829. int setvbuf( FILE *fp,
  4830.          char *buf,
  4831.          int mode,
  4832.          size_t size );
  4833.  
  4834. The  setvbuf  function can be used to associate a buffer with the file
  4835. designated  by "fp". If this function is used, it must be called after
  4836. the file has been opened and before it has been read or written.   The
  4837. argument  "mode"  determines  how  the    file "fp" will be buffered, as
  4838. follows:
  4839.  
  4840. _IOFBF    causes input/output to be fully buffered.
  4841.  
  4842. _IOLBF    causes    output to be line buffered (the buffer will be flushed
  4843.     when a new-line character is written, when the buffer is full,
  4844.     or when input is requested.
  4845.  
  4846. _IONBF    causes input/output to be completely unbuffered.
  4847.  
  4848. If the    argument  "buf" is not NULL, the array to which it points will
  4849. be used instead of an  automatically  allocated buffer.   The argument
  4850. "size" specifies the size of the array.
  4851. ::::SIGNAL
  4852. #include \<signal.h>
  4853. void ( *signal(int sig, void (*func)(int)) )( int );
  4854.  
  4855. The  signal  function  is used to specify an action to take place when
  4856. certain  conditions  are  detected  while a program  executes.     These
  4857. conditions are defined to be:
  4858.  
  4859. SIGABRT   abnormal termination, such as caused by the abort function
  4860.  
  4861. SIGBREAK  an  interactive   attention    (CTRL/BREAK  on  keyboard)  is
  4862.       signalled
  4863.  
  4864. SIGFPE      an  erroneous   floating-point  operation  occurs  (such  as
  4865.       division by zero, overflow and underflow)
  4866.  
  4867. SIGILL      illegal instruction encountered
  4868.  
  4869. SIGINT      an interactive attention (CTRL/C on keyboard) is signalled
  4870.  
  4871. SIGSEGV   an illegal memory reference is detected
  4872.  
  4873. SIGTERM   a termination request is sent to the program
  4874.  
  4875. SIGUSR1   OS/2 process flag A via DosFlagProcess
  4876.  
  4877. SIGUSR2   OS/2 process flag B via DosFlagProcess
  4878.  
  4879. SIGUSR3   OS/2 process flag C via DosFlagProcess
  4880.  
  4881. An action can be specified for each of the above conditions, depending
  4882. upon the value of the "func" argument:
  4883.  
  4884. function When  "func" is a function name, that function will be called
  4885.      equivalently to the following code sequence.
  4886.  
  4887.          /* "sig_no" is condition being signalled */
  4888.          signal( sig_no, SIG_DFL );
  4889.          (*func)( sig_no );
  4890.  
  4891.      The "func"  function may terminate the program by calling the
  4892.      exit  or  abort  functions  or  call  the  longjmp  function.
  4893.      Because   the    next  signal  will  be    handled  with  default
  4894.      handling, the program must again call signal if it is desired
  4895.      to  handle  the  next    condition  of the  type  that has been
  4896.      signalled.
  4897.  
  4898.      After    returning  from  the   signal-catching    function,  the
  4899.      receiving process will resume execution at the point at which
  4900.      it was interrupted.
  4901.  
  4902.      The signal catching function is described as follows:
  4903.  
  4904.          void func( int sig_no )
  4905.          {
  4906.          .
  4907.          .
  4908.          .
  4909.          }
  4910.  
  4911.      It is not possible to catch the signals SIGKILL and SIGSTOP.
  4912.  
  4913.      Since    signal-catching  functions are invoked    asynchronously
  4914.      with process  execution, the type sig_atomic_t may be used to
  4915.      define   variables  on  which    an  atomic   operation    (e.g.,
  4916.      incrementation, decrementation) may be performed.
  4917.  
  4918. SIG_DFL  This  value  causes the default  action for the  condition to
  4919.      occur.
  4920.  
  4921. SIG_IGN  This value causes the indicated condition to be ignored.
  4922.  
  4923. SIG_ACK  Used in OS/2 to acknowledge the receipt of a signal.    Once a
  4924.      process  receives a given  signal, the  operating system will
  4925.      not  send any more  signals of this type until it  receives a
  4926.      SIG_ACK acknowledgement back from the process.
  4927.  
  4928. When a    condition  is detected, it may be handled by a program, it may
  4929. be  ignored,  or it may be handled by the usual  default action (often
  4930. causing an error message to be printed upon the stderr stream followed
  4931. by program termination).
  4932.  
  4933. When the program begins execution, the equivalent of
  4934.  
  4935.     signal( SIGABRT, SIG_IGN );
  4936.     signal( SIGFPE, SIG_DFL );
  4937.     signal( SIGILL, SIG_DFL );
  4938.     signal( SIGINT, SIG_IGN );
  4939.     signal( SIGSEGV, SIG_DFL );
  4940.     signal( SIGTERM, SIG_DFL );
  4941.  
  4942. is executed.
  4943.  
  4944. A condition can be generated by a program using the raise function.
  4945. ::::SIN
  4946. #include \<math.h>
  4947. double sin( double x );
  4948.  
  4949. The sin  function  computes the sine of "x" (measured in radians).   A
  4950. large  magnitude  argument  may  yield    a  result  with  little  or no
  4951. significance.
  4952. ::::SINH
  4953. #include \<math.h>
  4954. double sinh( double x );
  4955.  
  4956. The sinh  function  computes the hyperbolic sine of "x". A range error
  4957. occurs if the magnitude of "x" is too large.
  4958. ::::SLEEP
  4959. #include \<dos.h>
  4960. void sleep( unsigned seconds );
  4961.  
  4962. The  sleep  function  suspends    execution by the  specified  number of
  4963. "seconds".
  4964. ::::SOPEN
  4965. #include \<io.h>
  4966. #include \<fcntl.h>
  4967. #include \<sys\stat.h>
  4968. #include \<sys\types.h>
  4969. #include \<share.h>
  4970. int sopen( const char *filename,
  4971.        int access, int share, ... );
  4972.  
  4973. The sopen  function  opens a file at the  operating  system  level for
  4974. shared    access.    The    name  of  the  file to be  opened  is given by
  4975. "filename".  The file will be  accessed  according  to the access mode
  4976. specified  by  "access".  When the file is be  created,  the  optional
  4977. argument must be given which establishes the future access permissions
  4978. for the file.    Additionally, the sharing mode of the file is given by
  4979. the "share" argument.     The optional argument is the file permissions
  4980. to be used when O_CREAT flag is on in the "access" mode.
  4981.  
  4982. The access  mode is  established  a combination of the bits defined in
  4983. \<fcntl.h> header file.  The following bits may be set:
  4984.  
  4985. O_RDONLY    permit the file to be only read.
  4986.  
  4987. O_WRONLY    permit the file to be only written.
  4988.  
  4989. O_RDWR        permit the file to be both read and written.
  4990.  
  4991. O_APPEND    causes  each  record  that is written to be written at the
  4992.         end of the file.
  4993.  
  4994. O_CREAT     has no  effect  when  the  file  indicated    by  "filename"
  4995.         already exists; otherwise, the file is created;
  4996.  
  4997. O_TRUNC     causes  the file to be  truncated  to contain no data when
  4998.         the  file  exists;    has no    effect    when the file does not
  4999.         exist.
  5000.  
  5001. O_BINARY    causes  the file to be  opened  in binary mode which means
  5002.         that  data    will  be  transmitted  to and  from  the  file
  5003.         unchanged.
  5004.  
  5005. O_TEXT        causes the file to be opened in text mode which means that
  5006.         carriage-return characters are written before any linefeed
  5007.         character  that  is  written  and  causes  carriage-return
  5008.         characters to be removed when encountered during reads.
  5009.  
  5010. When neither  O_TEXT nor O_BINARY are  specified, the default value in
  5011. the global  variable  _fmode is used to set the file translation mode.
  5012. When  the  program  begins  execution,    this  variable    has a value of
  5013. O_TEXT.
  5014.  
  5015. O_CREAT must be specified when the file does not exist and it is to be
  5016. written.
  5017.  
  5018. When the file is to be created ( O_CREAT is  specified), an additional
  5019. argument must be passed which contains the file permissions to be used
  5020. for the new file.   The access    permissions  for the file or directory
  5021. are  specified    as a  combination of bits (defined in the \<sys\stat.h>
  5022. header file).
  5023.  
  5024. The following bits define permissions for the owner.
  5025.  
  5026. S_IRWXU     Read, write, execute/search
  5027.  
  5028. S_IRUSR     Read permission
  5029.  
  5030. S_IWUSR     Write permission
  5031.  
  5032. S_IXUSR     Execute/search permission
  5033.  
  5034. The following bits define permissions for the group.
  5035.  
  5036. S_IRWXG     Read, write, execute/search
  5037.  
  5038. S_IRGRP     Read permission
  5039.  
  5040. S_IWGRP     Write permission
  5041.  
  5042. S_IXGRP     Execute/search permission
  5043.  
  5044. The following bits define permissions for others.
  5045.  
  5046. S_IRWXO     Read, write, execute/search
  5047.  
  5048. S_IROTH     Read permission
  5049.  
  5050. S_IWOTH     Write permission
  5051.  
  5052. S_IXOTH     Execute/search permission
  5053.  
  5054. The  following    bits define  miscellaneous  permissions  used by other
  5055. implementations.
  5056.  
  5057. S_IREAD     is equivalent to S_IRUSR (read permission)
  5058.  
  5059. S_IWRITE    is equivalent to S_IWUSR (write permission)
  5060.  
  5061. S_IEXEC     is equivalent to S_IXUSR (execute/search permission)
  5062.  
  5063. All  files  are  readable  with DOS; however, it is a good idea to set
  5064. S_IREAD when read permission is intended for the file.
  5065.  
  5066. The sopen  function  applies the current file  permission  mask to the
  5067. specified permissions (see umask).
  5068.  
  5069. The shared  access for the file is  established  by the combination of
  5070. bits set in "share" where the following values may be set:
  5071.  
  5072. SH_COMPAT      Set compatibility mode.
  5073.  
  5074. SH_DENYRW      Prevent read or write access to the file.
  5075.  
  5076. SH_DENYWR      Prevent write access of the file.
  5077.  
  5078. SH_DENYRD      Prevent read access to the file.
  5079.  
  5080. SH_DENYNO      Permit both read and write access to the file.
  5081.  
  5082. You should consult the technical documentation for the DOS system that
  5083. you are using for more detailed information about these sharing modes.
  5084. ::::SOUND
  5085. #include \<dos.h>
  5086. void sound( unsigned frequency );
  5087.  
  5088. The  sound  function  turns  on  the  PC's  speaker  at the  specified
  5089. "frequency".  The  frequency  is in  Hertz  (cycles per second).   The
  5090. speaker  can be turned off by calling  the  function  nosound after an
  5091. appropriate amount of time.
  5092. ::::SPAWN
  5093. #include \<process.h>
  5094. int spawnl(   mode, pgm, arg0, arg1..., argn, NULL );
  5095. int spawnle(  mode, pgm, arg0, arg1..., argn, NULL,envp);
  5096. int spawnlp(  mode, pgm, arg0, arg1..., argn, NULL );
  5097. int spawnlpe( mode, pgm, arg0, arg1..., argn, NULL,envp);
  5098. int spawnv(   mode, pgm, argv );
  5099. int spawnve(  mode, pgm, argv, envp );
  5100. int spawnvp(  mode, pgm, argv );
  5101. int spawnvpe( mode, pgm, argv, envp );
  5102.    int           mode;         /* mode for parent    */
  5103.    const char *pgm;         /* name of file       */
  5104.    const char *arg0, ..., *argn; /* arguments           */
  5105.    const char *argv[];         /* array of arguments */
  5106.    const char *envp[];         /* environment strings*/
  5107.  
  5108. The spawn  functions  create and execute a new child process, named by
  5109. "pgm". The value of "mode"  determines    how the  program is loaded and
  5110. how  the  invoking  program  will behave after the invoked  program is
  5111. initiated:
  5112.  
  5113. P_WAIT      The  invoked    program  is loaded into  available  memory, is
  5114.       executed, and then the original program resumes execution.
  5115.  
  5116. P_NOWAIT  Causes the current  program to execute concurrently with the
  5117.       new child process.
  5118.  
  5119. P_NOWAITO Causes the current  program to execute concurrently with the
  5120.       new  child  process.      The  functions  wait    and  cwait are
  5121.       ignored.
  5122.  
  5123. P_OVERLAY The invoked  program replaces the original program in memory
  5124.       and is executed.  No return is made to the original program.
  5125.       This is equivalent to calling the appropriate exec function.
  5126.  
  5127. The program is located by using the following logic in sequence:
  5128.  
  5129.    1. An attempt is made to locate the    program in the current working
  5130.       directory  if no    directory  specification  precedes the program
  5131.       name; otherwise, an attempt is made in the specified directory.
  5132.  
  5133.    2. If no file  extension  is  given, an attempt is made to find the
  5134.       program  name, in the  directory    indicated  in the first point,
  5135.       with .COM concatenated to the end of the program name.
  5136.  
  5137.    3. If no file  extension  is  given, an attempt is made to find the
  5138.       program  name, in the  directory    indicated  in the first point,
  5139.       with .EXE concatenated to the end of the program name.
  5140.  
  5141.    4. When no  directory specification is given as part of the program
  5142.       name,  the spawnlp,  spawnlpe,  spawnvp, and spawnvpe  functions
  5143.       will   repeat  the   preceding  three  steps  for  each  of  the
  5144.       directories  specified by the PATH  environment  variable.   The
  5145.       command
  5146.  
  5147.       path c:\myapps;d:\lib\applns
  5148.  
  5149.       indicates that the two directories
  5150.  
  5151.       c:\myapps
  5152.       d:\lib\applns
  5153.  
  5154.       are to be searched.  The DOS path command (without any directory
  5155.       specification)  will  cause  the current path  definition  to be
  5156.       displayed.
  5157.  
  5158. An error is detected when the program cannot be found.
  5159.  
  5160. Arguments  are passed to the child  process by    supplying  one or more
  5161. pointers to character strings as arguments in the spawn call.     These
  5162. character  strings are    concatenated  with spaces inserted to separate
  5163. the arguments to form one argument string for the child process.   The
  5164. length of this    concatenated  string must not exceed 128 bytes in real
  5165. mode.
  5166.  
  5167. The  arguments    may be passed as a list of arguments (spawnl, spawnle,
  5168. spawnlp,  and  spawnlpe)  or as a vector of pointers (spawnv, spawnve,
  5169. spawnvp, and spawnvpe).    At least one argument, "arg0" or "argv[0]",
  5170. must  be  passed  to the child    process.   By  convention,  this first
  5171. argument is a pointer to the name of the program.
  5172.  
  5173. If the arguments are passed as a list, there must be a NULL pointer to
  5174. mark  the end of the  argument    list.    Similarly,  if a pointer to an
  5175. argument vector is passed, the argument vector must be terminated by a
  5176. NULL pointer.
  5177.  
  5178. The  environment  for the invoked program is inherited from the parent
  5179. process  when  you  use  the  spawnl,  spawnlp,  spawnv,  and  spawnvp
  5180. functions.   The spawnle,  spawnlpe,  spawnve, and spawnvpe  functions
  5181. allow  a  different  environment  to be  passed  to the child  process
  5182. through the "envp" argument.    The argument "envp" is a pointer to an
  5183. array of character pointers, each of which points to a string defining
  5184. an environment variable.  The array is terminated with a NULL pointer.
  5185. Each pointer locates a character string of the form
  5186.  
  5187.     variable=value
  5188.  
  5189. that  is  used    to define an  environment  variable.   If the value of
  5190. "envp" is NULL, then the child process inherits the environment of the
  5191. parent process.
  5192.  
  5193. The  environment  is the  collection  of environment  variables  whose
  5194. values    that  have  been  defined  with the DOS SET  command or by the
  5195. successful execution of the putenv function.  A program may read these
  5196. values with the getenv function.
  5197. ::::SPAWNL
  5198.  ->SPAWN
  5199. ::::SPAWNLE
  5200.  ->SPAWN
  5201. ::::SPAWNLP
  5202.  ->SPAWN
  5203. ::::SPAWNLPE
  5204.  ->SPAWN
  5205. ::::SPAWNV
  5206.  ->SPAWN
  5207. ::::SPAWNVE
  5208.  ->SPAWN
  5209. ::::SPAWNVP
  5210.  ->SPAWN
  5211. ::::SPAWNVPE
  5212.  ->SPAWN
  5213. ::::SPRINTF
  5214. #include \<stdio.h>
  5215. int sprintf( char *buf, const char *format, ... );
  5216.  
  5217. The  sprintf  function    is  equivalent    to  fprintf,  except  that the
  5218. argument  "buf"  specifies a character    array into which the generated
  5219. output is placed, rather than to a file.    A null character is placed
  5220. at the end of the generated character string.    The "format" string is
  5221. described under the description for printf.
  5222. ::::SQRT
  5223. #include \<math.h>
  5224. double sqrt( double x );
  5225.  
  5226. The  sqrt  function  computes the  non-negative  square root of "x". A
  5227. domain error occurs if the argument is negative.
  5228. ::::SRAND
  5229. #include \<stdlib.h>
  5230. void srand( unsigned int seed );
  5231.  
  5232. The srand function uses the argument "seed" to start a new sequence of
  5233. pseudo-random integers to be returned by subsequent calls to rand.   A
  5234. particular  sequence  of  pseudo-random  integers  can be  repeated by
  5235. calling  srand with the same "seed"  value.   The default  sequence of
  5236. pseudo-random integers is selected with a "seed" value of 1.
  5237. ::::SSCANF
  5238. #include \<stdio.h>
  5239. int sscanf( const char *in_string,
  5240.         const char *format, ... );
  5241.  
  5242. The sscanf  function scans input from the character string "in_string"
  5243. under control of the argument "format". Following the format string is
  5244. the list of addresses of items to receive values.
  5245.  
  5246. The  format  string is described  under the  description  of the scanf
  5247. function.
  5248. ::::STACKAVAIL
  5249. #include \<malloc.h>
  5250. size_t stackavail(void);
  5251.  
  5252. The   stackavail  function  returns  the  number  of  bytes  currently
  5253. available  in the stack.   This value is usually  used to determine an
  5254. appropriate amount to allocate using alloca.
  5255. ::::STAT
  5256. #include \<sys\types.h>
  5257. #include \<sys\stat.h>
  5258. int stat( const char *path, struct stat *buf );
  5259.  
  5260. The  stat  function  obtains  information  about the file or directory
  5261. referenced  in    "path". This  information  is placed in the  structure
  5262. located at the address indicated by "buf".
  5263.  
  5264. The file \<sys\stat.h> contains definitions for the structure stat.
  5265.  
  5266. struct stat {
  5267.    dev_t   st_dev;    /* disk drive file resides on */
  5268.    ino_t   st_ino;    /* this inode's number        */
  5269.    unsigned short st_mode; /* file mode         */
  5270.    short   st_nlink;  /* # of hard links        */
  5271.    short   st_uid;    /* user-id, always 'root'     */
  5272.    short   st_gid;    /* group-id, always 'root'    */
  5273.    dev_t   st_rdev;   /* drive #, same as st_dev    */
  5274.    off_t   st_size;   /* total file size        */
  5275.    time_t  st_atime;  /* time of last access        */
  5276.    time_t  st_mtime;  /* time of last modification  */
  5277.    time_t  st_ctime;  /* time of last status change */
  5278. };
  5279.  
  5280. ::::STRCAT
  5281. #include \<string.h>
  5282. char *strcat( char *dst, const char *src );
  5283. char __far *_fstrcat( char __far *dst,
  5284.               const char __far *src );
  5285.  
  5286. The strcat and    _fstrcat functions append a copy of the string pointed
  5287. to by "src"  (including  the terminating null character) to the end of
  5288. the  string  pointed  to  by  "dst".  The  first  character  of  "src"
  5289. overwrites the null character at the end of "dst".
  5290.  
  5291. The  _fstrcat  function is a data model independent form of the strcat
  5292. function.  It accepts far pointer arguments and returns a far pointer.
  5293. It is most useful in mixed memory model applications.
  5294. ::::STRCHR
  5295. #include \<string.h>
  5296. char *strchr( const char *s, int c );
  5297. char __far *_fstrchr( const char __far *s, int c );
  5298.  
  5299. The strchr and _fstrchr  functions  locate the first occurrence of "c"
  5300. (converted to a char) in the string pointed to by "s". The terminating
  5301. null character is considered to be part of the string.
  5302.  
  5303. The  _fstrchr  function is a data model independent form of the strchr
  5304. function.  It accepts far pointer arguments and returns a far pointer.
  5305. It is most useful in mixed memory model applications.
  5306. ::::STRCMP
  5307. #include \<string.h>
  5308. int strcmp( const char *s1, const char *s2 );
  5309. int _fstrcmp( const char __far *s1,
  5310.           const char __far *s2 );
  5311.  
  5312. The  strcmp and _fstrcmp  functions  compare the string  pointed to by
  5313. "s1" to the string pointed to by "s2".
  5314.  
  5315. The  _fstrcmp  function is a data model independent form of the strcmp
  5316. function  that    accepts far pointer  arguments.   It is most useful in
  5317. mixed memory model applications.
  5318. ::::STRCMPI
  5319. #include \<string.h>
  5320. int strcmpi( const char *s1, const char *s2 );
  5321.  
  5322. The strcmpi  function  compares, with case  insensitivity,  the string
  5323. pointed to by "s1" to the string pointed to by "s2".
  5324. ::::STRCOLL
  5325. #include \<string.h>
  5326. int strcoll( const char *s1,
  5327.          const char *s2 );
  5328.  
  5329. The  strcoll  function    compares  the string pointed to by "s1" to the
  5330. string    pointed to by "s2". The comparison uses the collating sequence
  5331. selected by the setlocale function.    The function will be equivalent
  5332. to the strcmp  function  when the  collating sequence is selected from
  5333. the "C" locale.
  5334. ::::STRCPY
  5335. #include \<string.h>
  5336. char *strcpy( char *dst, const char *src );
  5337. char __far *_fstrcpy( char __far *dst,
  5338.               const char __far *src );
  5339.  
  5340. The strcpy and    _fstrcpy functions copy the string pointed to by "src"
  5341. (including  the  terminating null character) into the array pointed to
  5342. by "dst".  Copying of  overlapping  objects is not  guaranteed to work
  5343. properly.   See  the  description  for    the  memmove  function to copy
  5344. objects that overlap.
  5345.  
  5346. The  _fstrcpy  function is a data model independent form of the strcpy
  5347. function.  It accepts far pointer arguments and returns a far pointer.
  5348. It is most useful in mixed memory model applications.
  5349. ::::STRCSPN
  5350. #include \<string.h>
  5351. size_t strcspn( const char *str,
  5352.         const char *charset );
  5353. size_t _fstrcspn( const char __far *str,
  5354.           const char __far *charset );
  5355.  
  5356. The strcspn and  _fstrcspn functions compute the length of the initial
  5357. segment of the string  pointed to by "str"  which consists entirely of
  5358. characters   not  from    the  string   pointed  to  by  "charset".  The
  5359. terminating null character is not considered part of "str".
  5360.  
  5361. The _fstrcspn function is a data model independent form of the strcspn
  5362. function  that    accepts far pointer  arguments.   It is most useful in
  5363. mixed memory model applications.
  5364. ::::STRDUP
  5365. #include \<string.h>
  5366. char *strdup( const char *src );
  5367.  
  5368. The strdup  function creates a duplicate copy of the string pointed to
  5369. by "src"  and  returns a pointer to the new copy.   The memory for the
  5370. new string is  obtained  by using the malloc function and can be freed
  5371. using the free function.
  5372. ::::STREAM
  5373.              Stream I/O Functions
  5374.              ════════════════════
  5375.  
  5376. A stream  is the name  given to a file or device which has been opened
  5377. for data transmission.      When a stream is opened, a pointer to a FILE
  5378. structure is returned.      This pointer is used to reference the stream
  5379. when other functions are subsequently invoked.
  5380.  
  5381. The following functions are defined:
  5382.  
  5383. <clearerr>    clear end-of-file and error indicators for stream
  5384. <fclose>    close stream
  5385. <fcloseall>    close all open streams
  5386. <fdopen>    open stream, given handle
  5387. <feof>        test for end of file
  5388. <ferror>    test for file error
  5389. <fflush>    flush output buffer
  5390. <fgetc>     get next character from file
  5391. <fgetchar>    equivalent to fgetc with the argument stdin
  5392. <fgetpos>    get current file position
  5393. <fgets>     get a string
  5394. <flushall>    flush output buffers for all streams
  5395. <fopen>     open a stream
  5396. <fprintf>    format output
  5397. <fputc>     write a character
  5398. <fputchar>    write a character to the stdout stream
  5399. <fputs>     write a string
  5400. <fread>     read a number of objects
  5401. <freopen>    re-opens a stream
  5402. <fscanf>    scan input according to format
  5403. <fseek>     set current file position, relative
  5404. <fsetpos>    set current file position, absolute
  5405. <ftell>     get current file position
  5406. <fwrite>    write a number of objects
  5407. <getc>        read character
  5408. <getchar>    get next character from stdin
  5409. <gets>        get string from stdin
  5410. <perror>    write error message to stderr stream
  5411. <printf>    format output to stdout
  5412. <putc>        write character to file
  5413. <putchar>    write character to stdout
  5414. <puts>        write string to stdout
  5415. <rewind>    position to start of file
  5416. <scanf>     scan input from stdin under format control
  5417. <setbuf>    set buffer
  5418. <setvbuf>    set buffering
  5419. <tmpfile>    create temporary file
  5420. <ungetc>    push character back on input stream
  5421. <vfprintf>    same as fprintf but with variable arguments
  5422. <vfscanf>    same as fscanf but with variable arguments
  5423. <vprintf>    same as printf but with variable arguments
  5424. <vscanf>    same as scanf but with variable arguments
  5425.  
  5426. See  also  <file>  (file   manipulation   functions)  and  <operating>
  5427. (operating  system i/o    functions) for other  functions  which operate
  5428. upon files.
  5429. ::::STRERROR
  5430. #include \<string.h>
  5431. char *strerror( int errnum );
  5432.  
  5433. The strerror  function    maps the error number contained in "errnum" to
  5434. an error message.
  5435. ::::STRFTIME
  5436. #include \<time.h>
  5437. size_t strftime(char *s,
  5438.         size_t maxsize,
  5439.         const char *format,
  5440.         const struct tm *timeptr );
  5441.  
  5442. struct    tm {
  5443.   int tm_sec;    /* seconds after the minute -- [0,61] */
  5444.   int tm_min;    /* minutes after the hour   -- [0,59] */
  5445.   int tm_hour;    /* hours after midnight     -- [0,23] */
  5446.   int tm_mday;    /* day of the month        -- [1,31] */
  5447.   int tm_mon;    /* months since January     -- [0,11] */
  5448.   int tm_year;    /* years since 1900              */
  5449.   int tm_wday;    /* days since Sunday        -- [0,6]  */
  5450.   int tm_yday;    /* days since January 1     -- [0,365]*/
  5451.   int tm_isdst; /* Daylight Savings Time flag */
  5452. };
  5453.  
  5454. The strftime  function formats the time in the argument "timeptr" into
  5455. the array  pointed to by the  argument    "s"  according to the "format"
  5456. argument.  The "format" string consists of zero or more directives and
  5457. ordinary characters.  A directive consists of a '%' character followed
  5458. by a character that determines the substitution that is to take place.
  5459. All ordinary characters are copied unchanged into the array.   No more
  5460. than  "maxsize"  characters  are  placed  in the  array.    The format
  5461. directives %D, %h, %n, %r, %t, and %T are from POSIX.
  5462.  
  5463. %a  locale's abbreviated weekday name
  5464.  
  5465. %A  locale's full weekday name
  5466.  
  5467. %b  locale's abbreviated month name
  5468.  
  5469. %B  locale's full month name
  5470.  
  5471. %c  locale's appropriate date and time representation
  5472.  
  5473. %d  day of the month as a decimal number (01-31)
  5474.  
  5475. %D  date in the format mm/dd/yy (POSIX)
  5476.  
  5477. %h  locale's abbreviated month name (POSIX)
  5478.  
  5479. %H  hour (24-hour clock) as a decimal number (00-23)
  5480.  
  5481. %I  hour (12-hour clock) as a decimal number (01-12)
  5482.  
  5483. %j  day of the year as a decimal number (001-366)
  5484.  
  5485. %m  month as a decimal number (01-12)
  5486.  
  5487. %M  minute as a decimal number (00-59)
  5488.  
  5489. %n  newline character (POSIX)
  5490.  
  5491. %p  locale's equivalent of either AM or PM
  5492.  
  5493. %r  12-hour  clock time (01-12) using the AM/PM notation in the format
  5494.     HH:MM:SS (AM|PM) (POSIX)
  5495.  
  5496. %S  second as a decimal number (00-59)
  5497.  
  5498. %t  tab character (POSIX)
  5499.  
  5500. %T  24-hour clock time in the format HH:MM:SS (POSIX)
  5501.  
  5502. %U  week  number of the year as a decimal  number (00-52) where Sunday
  5503.     is the first day of the week
  5504.  
  5505. %w  weekday as a decimal number (0-6) where 0 is Sunday
  5506.  
  5507. %W  week  number of the year as a decimal  number (00-52) where Monday
  5508.     is the first day of the week
  5509.  
  5510. %x  locale's appropriate date representation
  5511.  
  5512. %X  locale's appropriate time representation
  5513.  
  5514. %y  year without century as a decimal number (00-99)
  5515.  
  5516. %Y  year with century as a decimal number
  5517.  
  5518. %Z  timezone name, or by no characters if no timezone exists
  5519.  
  5520. %%  character %
  5521. ::::STRICMP
  5522. #include \<string.h>
  5523. int stricmp( const char *s1, const char *s2 );
  5524. int _fstricmp( const char __far *s1,
  5525.            const char __far *s2 );
  5526.  
  5527. The stricmp and _fstricmp  functions compare, with case insensitivity,
  5528. the  string  pointed  to by "s1" to the string pointed to by "s2". All
  5529. upper-case  characters from "s1" and "s2" are mapped to lower-case for
  5530. the purposes of doing the comparison.
  5531.  
  5532. The _fstricmp function is a data model independent form of the stricmp
  5533. function  that    accepts far pointer  arguments.   It is most useful in
  5534. mixed memory model applications.
  5535. ::::STRING
  5536.              String Manipulation Functions
  5537.              ═════════════════════════════
  5538.  
  5539. A string is an array of characters (with type char) that is terminated
  5540. with an extra null  character  ('\0').     Functions are passed only the
  5541. address of the string  since the size can be  determined  by searching
  5542. for the  terminating  character.   The    functions that begin with "_f"
  5543. accept far pointers as their  arguments  allowing  manipulation of any
  5544. memory location regardless of which memory model your program has been
  5545. compiled for.  The following functions are defined:
  5546.  
  5547. <_fstrcat>    concatenate two far strings
  5548. <_fstrchr>    locate character in far string
  5549. <_fstrcmp>    compare two far strings
  5550. <_fstrcpy>    copy far string
  5551. <_fstrcspn>    get  number  of  string  characters  not from a set of
  5552.         characters
  5553. <_fstricmp>    compare two far strings with case insensitivity
  5554. <_fstrlen>    length of a far string
  5555. <_fstrlwr>    convert far string to lower-case
  5556. <_fstrncat>    concatenate two far strings, up to a maximum length
  5557. <_fstrncmp>    compare two far strings up to maximum length
  5558. <_fstrncpy>    copy a far string, up to a maximum length
  5559. <_fstrnicmp>    compare two far strings with case  insensitivity up to
  5560.         a maximum length
  5561. <_fstrnset>    fill far string with character to a maximum length
  5562. <_fstrpbrk>    locate occurrence of a string within a second string
  5563. <_fstrrchr>    locate last  occurrence  of character from a character
  5564.         set
  5565. <_fstrrev>    reverse a far string in place
  5566. <_fstrset>    fill far string with a character
  5567. <_fstrspn>    find number of characters at start of string which are
  5568.         also in a second string
  5569. <_fstrstr>    find first occurrence of string in second string
  5570. <_fstrtok>    get next token from a far string
  5571. <_fstrupr>    convert far string to upper-case
  5572. <sprintf>    formatted transmission to string
  5573. <sscanf>    scan from string under format control
  5574. <strcat>    concatenate string
  5575. <strchr>    locate character in string
  5576. <strcmp>    compare two strings
  5577. <strcmpi>    compare two strings with case insensitivity
  5578. <strcoll>    compare two strings using locale collating sequence
  5579. <strcpy>    copy a string
  5580. <strcspn>    get  number  of  string  characters  not from a set of
  5581.         characters
  5582. <strdup>    allocate and duplicate a string
  5583. <strerror>    get error message as string
  5584. <stricmp>    compare two strings with case insensitivity
  5585. <strlen>    string length
  5586. <strlwr>    convert string to lower-case
  5587. <strncat>    concatenate two strings, up to a maximum length
  5588. <strncmp>    compare two strings up to maximum length
  5589. <strncpy>    copy a string, up to a maximum length
  5590. <strnicmp>    compare  two  strings  with case insensitivity up to a
  5591.         maximum length
  5592. <strnset>    fill string with character to a maximum length
  5593. <strpbrk>    locate occurrence of a string within a second string
  5594. <strrchr>    locate last  occurrence  of character from a character
  5595.         set
  5596. <strrev>    reverse a string in place
  5597. <strset>    fill string with a character
  5598. <strspn>    find number of characters at start of string which are
  5599.         also in a second string
  5600. <strstr>    find first occurrence of string in second string
  5601. <strtok>    get next token from string
  5602. <strupr>    convert string to upper-case
  5603. <strxfrm>    transform string to locale's collating sequence
  5604. <vsprintf>    same as sprintf but with variable arguments
  5605. <vsscanf>    same as sscanf but with variable arguments
  5606.  
  5607. For  related  functions  see  <conversion>  (conversions to  and  from
  5608. strings),  <time>  (formatting    of  dates  and    times),  and  <memory>
  5609. (operate on arrays without terminating null character).
  5610. ::::STRLEN
  5611. #include \<string.h>
  5612. size_t strlen( const char *s );
  5613. size_t _fstrlen( const char __far *s );
  5614.  
  5615. The  strlen  and _fstrlen  functions  compute the length of the string
  5616. pointed to by "s".
  5617.  
  5618. The  _fstrlen  function is a data model independent form of the strlen
  5619. function  that    accepts far pointer  arguments.   It is most useful in
  5620. mixed memory model applications.
  5621. ::::STRLWR
  5622. #include \<string.h>
  5623. char *strlwr( char *str );
  5624. char __far *_fstrlwr( char __far *str );
  5625.  
  5626. These  functions  replace the string str with lower-case characters by
  5627. invoking the tolower function for each character in the string.
  5628.  
  5629. The  _fstrlwr  function is a data model independent form of the strlwr
  5630. function.  It accepts far pointer arguments and returns a far pointer.
  5631. It is most useful in mixed memory model applications.
  5632. ::::STRNCAT
  5633. #include \<string.h>
  5634. char *strncat( char *dst, const char *src, size_t n );
  5635. char __far *_fstrncat( char __far *dst,
  5636.                const char __far *src,
  5637.                size_t n );
  5638.  
  5639. The  strncat  and   _fstrncat  functions  append  not  more  than  "n"
  5640. characters  of the string pointed to by "src" to the end of the string
  5641. pointed to by "dst". The first    character of "src" overwrites the null
  5642. character  at the end of "dst". A terminating null character is always
  5643. appended to the result.
  5644.  
  5645. The _fstrncat function is a data model independent form of the strncat
  5646. function.  It accepts far pointer arguments and returns a far pointer.
  5647. It is most useful in mixed memory model applications.
  5648. ::::STRNCMP
  5649. #include \<string.h>
  5650. int strncmp( const char *s1,
  5651.          const char *s2,
  5652.          size_t n );
  5653. int _fstrncmp( const char __far *s1,
  5654.            const char __far *s2,
  5655.            size_t n );
  5656.  
  5657. The  strncmp  and  _fstrncmp  functions  compare  not  more  than  "n"
  5658. characters from the string pointed to by "s1" to the string pointed to
  5659. by "s2".
  5660.  
  5661. The _fstrncmp function is a data model independent form of the strncmp
  5662. function  that    accepts far pointer  arguments.   It is most useful in
  5663. mixed memory model applications.
  5664. ::::STRNCPY
  5665. #include \<string.h>
  5666. char *strncpy( char *dst,
  5667.            const char *src,
  5668.            size_t n );
  5669. char __far *_fstrncpy( char __far *dst,
  5670.                const char __far *src,
  5671.                size_t n );
  5672.  
  5673. The strncpy and  _fstrncpy  functions copy no more than "n" characters
  5674. from  the  string  pointed  to by  "src" into the array  pointed to by
  5675. "dst".    Copying  of  overlapping  objects  is not  guaranteed  to work
  5676. properly.    See the memmove function if you wish to copy objects that
  5677. overlap.
  5678.  
  5679. If the string pointed to by "src" is shorter than "n" characters, null
  5680. characters  are appended to the copy in the array pointed to by "dst,"
  5681. until "n" characters in all have been written.     If the string pointed
  5682. to by "src" is longer than "n" characters, then the result will not be
  5683. terminated by a null character.
  5684.  
  5685. The _fstrncpy function is a data model independent form of the strncpy
  5686. function.  It accepts far pointer arguments and returns a far pointer.
  5687. It is most useful in mixed memory model applications.
  5688. ::::STRNICMP
  5689. #include \<string.h>
  5690. int strnicmp( const char *s1,
  5691.           const char *s2,
  5692.           size_t len );
  5693. int _fstrnicmp( const char __far *s1,
  5694.         const char __far *s2,
  5695.         size_t len );
  5696.  
  5697. The   strnicmp    and  _fstrnicmp   functions   compare,     without  case
  5698. sensitivity, the string pointed to by "s1" to the string pointed to by
  5699. "s2," for at most "len" characters.
  5700.  
  5701. The  _fstrnicmp  function  is a data  model  independent  form    of the
  5702. strnicmp  function  that  accepts far pointer  arguments.   It is most
  5703. useful in mixed memory model applications.
  5704. ::::STRNSET
  5705. #include \<string.h>
  5706. char *strnset( char *s1,
  5707.            int fill,
  5708.            const size_t len );
  5709. char __far *_fstrnset( char __far *s1,
  5710.                int fill,
  5711.                const size_t len );
  5712.  
  5713. The  strnset  and  _fstrnset  functions  fill the string "s1" with the
  5714. value of the argument "fill," converted to be a character value.  When
  5715. the  value  of    "len" is greater  than the length of the  string,  the
  5716. entire string is filled.   Otherwise, that number of characters at the
  5717. start of the string are set to the fill character.
  5718.  
  5719. The _fstrnset function is a data model independent form of the strnset
  5720. function.  It accepts far pointer arguments and returns a far pointer.
  5721. It is most useful in mixed memory model applications.
  5722. ::::STRPBRK
  5723. #include \<string.h>
  5724. char *strpbrk( const char *str, const char *charset );
  5725. char __far *_fstrpbrk( const char __far *str,
  5726.                const char __far *charset );
  5727.  
  5728. The strpbrk and _fstrpbrk functions locate the first occurrence in the
  5729. string pointed to by "str" of any character from the string pointed to
  5730. by "charset".
  5731.  
  5732. The _fstrpbrk function is a data model independent form of the strpbrk
  5733. function.  It accepts far pointer arguments and returns a far pointer.
  5734. It is most useful in mixed memory model applications.
  5735. ::::STRRCHR
  5736. #include \<string.h>
  5737. char *strrchr( const char *s, int c );
  5738. char __far *_fstrrchr( const char __far *s, int c );
  5739.  
  5740. The strrchr and  _fstrrchr functions locate the last occurrence of "c"
  5741. (converted to a char) in the string pointed to by "s". The terminating
  5742. null character is considered to be part of the string.
  5743.  
  5744. The _fstrrchr function is a data model independent form of the strrchr
  5745. function.  It accepts far pointer arguments and returns a far pointer.
  5746. It is most useful in mixed memory model applications.
  5747. ::::STRREV
  5748. #include \<string.h>
  5749. char *strrev( char *s1 );
  5750. char __far *_fstrrev( char __far *s1 );
  5751.  
  5752. The strrev and    _fstrrev functions replace the string s1 with a string
  5753. whose characters are in the reverse order.
  5754.  
  5755. The  _fstrrev  function is a data model independent form of the strrev
  5756. function.  It accepts far pointer arguments and returns a far pointer.
  5757. It is most useful in mixed memory model applications.
  5758. ::::STRSET
  5759. #include \<string.h>
  5760. char *strset( char *s1, char fill );
  5761. char __far *_fstrset( char __far *s1, char fill );
  5762.  
  5763. The strset and    _fstrset  functions  fill the string  pointed to by s1
  5764. with  the  character  fill.   The  terminating    null  character in the
  5765. original string remains unchanged.
  5766.  
  5767. The  _fstrset  function is a data model independent form of the strset
  5768. function.  It accepts far pointer arguments and returns a far pointer.
  5769. It is most useful in mixed memory model applications.
  5770. ::::STRSPN
  5771. #include \<string.h>
  5772. size_t strspn( const char *str,
  5773.            const char *charset );
  5774. size_t _fstrspn( const char __far *str,
  5775.          const char __far *charset );
  5776.  
  5777. The  strspn and _fstrspn  functions  compute the length of the initial
  5778. segment of the string pointed to by "str" which consists of characters
  5779. from  the  string  pointed  to    by  "charset".    The  terminating  null
  5780. character is not considered to be part of "charset".
  5781.  
  5782. The  _fstrspn  function is a data model independent form of the strspn
  5783. function  that    accepts far pointer  arguments.   It is most useful in
  5784. mixed memory model applications.
  5785. ::::STRSTR
  5786. #include \<string.h>
  5787. char *strstr( const char *str,
  5788.           const char *substr );
  5789. char __far *_fstrstr( const char __far *str,
  5790.               const char __far *substr );
  5791.  
  5792. The strstr and _fstrstr  functions  locate the first occurrence in the
  5793. string    pointed to by "str" of the  sequence  of characters (excluding
  5794. the terminating null character) in the string pointed to by "substr".
  5795.  
  5796. The  _fstrstr  function is a data model independent form of the strstr
  5797. function.  It accepts far pointer arguments and returns a far pointer.
  5798. It is most useful in mixed memory model applications.
  5799. ::::STRTOD
  5800. #include \<stdlib.h>
  5801. double strtod( const char *ptr, char **endptr );
  5802.  
  5803. The strtod  function converts the string pointed to by "ptr" to double
  5804. representation.  The function recognizes a string containing :
  5805.  
  5806.    * optional white space,
  5807.  
  5808.    * an optional plus or minus sign,
  5809.  
  5810.    * a sequence of digits containing an optional decimal point,
  5811.  
  5812.    * an  optional 'e' or 'E' followed by an optionally signed sequence
  5813.     of digits.
  5814.  
  5815. The conversion ends at the first unrecognized character.  A pointer to
  5816. that  character  will be stored in the object to which "endptr" points
  5817. if "endptr" is not NULL.
  5818. ::::STRTOK
  5819. #include \<string.h>
  5820. char *strtok( char *s1, const char *s2 );
  5821. char __far *_fstrtok( char __far *s1,
  5822.               const char __far *s2 );
  5823.  
  5824. The strtok and _fstrtok functions are used to break the string pointed
  5825. to by "s1"  into a sequence of tokens, each of which is delimited by a
  5826. character from the string pointed to by "s2". The first call to strtok
  5827. will  return a pointer to the first  token in the string pointed to by
  5828. "s1". Subsequent calls to strtok must pass a NULL pointer as the first
  5829. argument,  in order to get the next  token in the string.   The set of
  5830. delimiters used in each of these calls to strtok can be different from
  5831. one call to the next.
  5832.  
  5833. The first call in the  sequence  searches "s1" for the first character
  5834. that is not contained in the current delimiter string "s2". If no such
  5835. character  is  found,  then there are no tokens in "s1" and the strtok
  5836. function returns a NULL pointer.   If such a character is found, it is
  5837. the start of the first token.
  5838.  
  5839. The strtok  function  then searches from there for a character that is
  5840. contained in the current  delimiter  string.   If no such character is
  5841. found, the  current  token extends to the end of the string pointed to
  5842. by "s1". If such a  character  is  found,  it is overwritten by a null
  5843. character,  which  terminates the current token.   The strtok function
  5844. saves a pointer to the following character, from which the next search
  5845. for a token will start when the first argument is a NULL pointer.
  5846.  
  5847. Because  strtok may modify the original  string, that string should be
  5848. duplicated if the string is to be re-used.
  5849.  
  5850. The  _fstrtok  function is a data model independent form of the strtok
  5851. function.  It accepts far pointer arguments and returns a far pointer.
  5852. It is most useful in mixed memory model applications.
  5853. ::::STRTOL
  5854. #include \<stdlib.h>
  5855. long int strtol( const char *ptr,
  5856.          char **endptr,
  5857.          int base );
  5858.  
  5859. The  strtol  function  converts  the string  pointed to by "ptr" to an
  5860. object of type long int.  The function recognizes a string containing:
  5861.  
  5862.    * optional white space,
  5863.  
  5864.    * an optional plus or minus sign,
  5865.  
  5866.    * a sequence of digits and letters.
  5867.  
  5868. The conversion ends at the first unrecognized character.  A pointer to
  5869. that  character  will be stored in the object to which "endptr" points
  5870. if "endptr" is not NULL.
  5871.  
  5872. If  "base"  is    zero,  the first  characters  after the optional  sign
  5873. determine the base used for the conversion.    If the first characters
  5874. are "0x" or "0X" the digits are treated as hexadecimal.   If the first
  5875. character  is  '0', the digits are  treated as octal.    Otherwise  the
  5876. digits are treated as decimal.
  5877.  
  5878. If  "base"  is not  zero, it must have a value between 2 and 36.   The
  5879. letters  a-z and A-Z  represent the values 10 through 35.   Only those
  5880. letters  whose    designated  values are less than "base" are permitted.
  5881. If  the  value    of  "base"  is    16,  the  characters  "0x" or "0X" may
  5882. optionally precede the sequence of letters and digits.
  5883. ::::STRTOUL
  5884. #include \<stdlib.h>
  5885. unsigned long int strtoul( const char *ptr,
  5886.                char **endptr,
  5887.                int base );
  5888.  
  5889. The  strtoul  function    converts  the string pointed to by "ptr" to an
  5890. unsigned long.      The function recognizes a string containing optional
  5891. white  space,  followed  by a  sequence  of digits and    letters.   The
  5892. conversion  ends at the first  unrecognized  character.   A pointer to
  5893. that  character  will  be stored in the object    "endptr"  points to if
  5894. "endptr" is not NULL.
  5895.  
  5896. If "base" is zero, the first  characters  determine  the base used for
  5897. the conversion.    If the first characters are "0x" or "0X" the digits
  5898. are treated as hexadecimal.  If the first character is '0', the digits
  5899. are treated as octal.  Otherwise the digits are treated as decimal.
  5900.  
  5901. If "base" is not zero, it must have a value of between 2 and 36.   The
  5902. letters  a-z and A-Z  represent the values 10 through 35.   Only those
  5903. letters  whose    designated  values are less than "base" are permitted.
  5904. If  the  value    of  "base"  is    16,  the  characters  "0x" or "0X" may
  5905. optionally precede the sequence of letters and digits.
  5906. ::::STRUPR
  5907. #include \<string.h>
  5908. char *strupr( char *s1 );
  5909. char __far *_fstrupr( char __far *s1 );
  5910.  
  5911. These  functions  replace the string s1 with  upper-case characters by
  5912. invoking the toupper function for each character in the string.
  5913.  
  5914. The  _fstrupr  function is a data model independent form of the strupr
  5915. function.  It accepts far pointer arguments and returns a far pointer.
  5916. It is most useful in mixed memory model applications.
  5917. ::::STRXFRM
  5918. #include \<string.h>
  5919. size_t strxfrm( char *dst,
  5920.         const char *src,
  5921.         size_t n );
  5922.  
  5923. The strxfrm  function transforms, for no more than "n" characters, the
  5924. string    pointed  to by    "src"  to the buffer  pointed to by "dst". The
  5925. transformation    uses the collating  sequence selected by the setlocale
  5926. function  so  that two    transformed  strings will compare  identically
  5927. (using the  strncmp  function)    to a  comparison  of the  original two
  5928. strings using the strcoll function.    The function will be equivalent
  5929. to the    strncpy  function  (except  there  is no  padding of the "dst"
  5930. argument  with null characters when the argument "src" is shorter than
  5931. "n"  characters)  when the collating sequence is selected from the "C"
  5932. locale.
  5933. ::::SWAB
  5934. #include \<stdlib.h>
  5935. void swab( char *src, char *dest, int num );
  5936.  
  5937. The swab function copies "num" bytes (which should be even) from "src"
  5938. to  "dest"  swapping  every  pair of  characters.   This is useful for
  5939. preparing  binary data to be transferred to another machine that has a
  5940. different byte ordering.
  5941. ::::SYSTEM
  5942. #include \<stdlib.h>
  5943. int system( const char *command );
  5944.  
  5945. If the value of "command" is NULL, then the system function determines
  5946. whether or not a command  processor  is present (COMMAND.COM in DOS or
  5947. CMD.EXE in OS/2).
  5948.  
  5949. Otherwise,   the  system  function  invokes  a    copy  of  the  command
  5950. processor, and passes the string "command" to it for processing.  This
  5951. function  uses    spawnl    to  load  a  copy  of  the  command  processor
  5952. identified by the COMSPEC environment variable.
  5953.  
  5954. This  means  that  any    command  that  can  be    entered  to DOS can be
  5955. executed,  including  programs,  DOS  commands    and batch files.   The
  5956. exec...    and    spawn...   functions  can  only  cause    programs to be
  5957. executed.
  5958. ::::TAN
  5959. #include \<math.h>
  5960. double tan( double x );
  5961.  
  5962. The tan function computes the tangent of "x" (measured in radians).  A
  5963. large  magnitude  argument  may  yield    a  result  with  little  or no
  5964. significance.
  5965. ::::TANH
  5966. #include \<math.h>
  5967. double tanh( double x );
  5968.  
  5969. The tanh function computes the hyperbolic tangent of "x".
  5970.  
  5971. When the "x"  argument is large, partial or total loss of significance
  5972. may occur.  The matherr function will be invoked in this case.
  5973. ::::TELL
  5974. #include \<io.h>
  5975. long int tell( int handle );
  5976.  
  5977. The  tell  function  determines  the  current  file  position  at  the
  5978. operating  system  level.    The  "handle"  value  is the file    handle
  5979. returned by a successful execution of the open function.
  5980.  
  5981. The  returned value may be used in conjunction with the lseek function
  5982. to reset the current file position.
  5983. ::::TIME
  5984.                 Time Functions
  5985.                 ══════════════
  5986.  
  5987. These  functions  are  concerned with dates and times.     The following
  5988. functions are defined:
  5989.  
  5990. <asctime>    makes time string from time structure
  5991. <clock>     gets time since program start
  5992. <ctime>     gets calendar time string
  5993. <difftime>    calculate difference between two times
  5994. <ftime>     returns the current time in a timeb structure
  5995. <gmtime>    convert  calendar  time to Coordinated    Universal Time
  5996.         (UTC)
  5997. <localtime>    convert calendar time to local time
  5998. <mktime>    make calendar time from local time
  5999. <strftime>    format date and time
  6000. <tzset>     set global variables to reflect the local time zone
  6001. ::::TIME
  6002. #include \<time.h>
  6003. time_t time( time_t *tloc );
  6004.  
  6005. The time  function determines the current calendar time and encodes it
  6006. into the type time_t.
  6007.  
  6008. The  time  represents  the  time  since  January  1, 1970  Coordinated
  6009. Universal Time (UTC) (formerly known as Greenwich Mean Time (GMT)).
  6010.  
  6011. The time set on the  computer  with the DOS time  command  and the DOS
  6012. date command reflects the local time.    The environment variable TZ is
  6013. used to establish the time zone to which this local time applies.  See
  6014. the section The TZ Environment Variable for a discussion of how to set
  6015. the time zone.
  6016. ::::TMPFILE
  6017. #include \<stdio.h>
  6018. FILE *tmpfile( void );
  6019.  
  6020. The  tmpfile  function    creates  a  temporary  binary  file  that will
  6021. automatically  be removed when it is closed or at program termination.
  6022. The file is opened for update.
  6023. ::::TMPNAM
  6024. #include \<stdio.h>
  6025. char *tmpnam( char *buffer );
  6026.  
  6027. The  tmpnam  function  generates  a  unique  string for use as a valid
  6028. filename.
  6029. ::::TOLOWER
  6030. #include \<ctype.h>
  6031. int tolower( int c );
  6032.  
  6033. The   tolower    function   converts  an   upper-case   letter  to  the
  6034. corresponding lower-case letter.
  6035. ::::TOUPPER
  6036. #include \<ctype.h>
  6037. int toupper( int c );
  6038.  
  6039. The  function  converts  a lower-case  character to the  corresponding
  6040. upper-case character.
  6041. ::::TZSET
  6042. #include \<time.h>
  6043. void tzset( void );
  6044.  
  6045. The tzset function sets the global  variables  daylight,  timezone and
  6046. tzname    according to the value of the TZ  environment  variable.   The
  6047. section  The  TZ  Environment  Variable  describes  how  to  set  this
  6048. variable.
  6049.  
  6050. The  global  variables    have  the  following  values  after  tzset  is
  6051. executed:
  6052.  
  6053. daylight    Zero  indicates that daylight saving time is not supported
  6054.         in the locale; a non-zero  value  indicates  that daylight
  6055.         saving time is supported in the locale.   This variable is
  6056.         cleared/set  after a call to the tzset  function depending
  6057.         on    whether  a  daylight   saving  time   abbreviation  is
  6058.         specified in the TZ environment variable.
  6059.  
  6060. timezone    Contains the number of seconds that the local time zone is
  6061.         earlier than  Coordinated  Universal Time (UTC)  (formerly
  6062.         known as Greenwich Mean Time (GMT)).
  6063.  
  6064. tzname        Two-element   array   pointing   to  strings   giving  the
  6065.         abbreviations  for the name of the time zone when standard
  6066.         and daylight saving time are in effect.
  6067.  
  6068. The time set on the  computer  with the DOS time  command  and the DOS
  6069. date command reflects the local time.    The environment variable TZ is
  6070. used to establish the time zone to which this local time applies.  See
  6071. the section The TZ Environment Variable for a discussion of how to set
  6072. the time zone.
  6073. ::::ULTOA
  6074. #include \<stdlib.h>
  6075. char *ultoa( unsigned long int value,
  6076.          char *buffer,
  6077.          int radix );
  6078.  
  6079. The ultoa function  converts the unsigned  binary integer "value" into
  6080. the  equivalent  string in base "radix" notation storing the result in
  6081. the  character    array  pointed    to by  "buffer".  A null  character is
  6082. appended  to the  result.   The size of  "buffer"  must be at least 33
  6083. bytes when converting values in base 2.
  6084. ::::UMASK
  6085. #include \<sys\types.h>
  6086. #include \<sys\stat.h>
  6087. #include \<fcntl.h>
  6088. #include \<io.h>
  6089. int umask( int cmask );
  6090.  
  6091. The umask  function  sets the  process's  file mode  creation  mask to
  6092. "cmask". The  process's  file mode creation mask is used during creat,
  6093. open,  or  sopen  to  turn  off  permission  bits in the  "permission"
  6094. argument supplied.    In other words, if a bit in the mask is on, then
  6095. the  corresponding  bit in the file's  requested  permission  value is
  6096. disallowed.
  6097.  
  6098. The argument  "cmask" is a constant expression involving the constants
  6099. described below.  The access permissions for the file or directory are
  6100. specified as a combination of bits (defined in the \<sys\stat.h> header
  6101. file).
  6102.  
  6103. The following bits define permissions for the owner.
  6104.  
  6105. S_IRWXU     Read, write, execute/search
  6106.  
  6107. S_IRUSR     Read permission
  6108.  
  6109. S_IWUSR     Write permission
  6110.  
  6111. S_IXUSR     Execute/search permission
  6112.  
  6113. The following bits define permissions for the group.
  6114.  
  6115. S_IRWXG     Read, write, execute/search
  6116.  
  6117. S_IRGRP     Read permission
  6118.  
  6119. S_IWGRP     Write permission
  6120.  
  6121. S_IXGRP     Execute/search permission
  6122.  
  6123. The following bits define permissions for others.
  6124.  
  6125. S_IRWXO     Read, write, execute/search
  6126.  
  6127. S_IROTH     Read permission
  6128.  
  6129. S_IWOTH     Write permission
  6130.  
  6131. S_IXOTH     Execute/search permission
  6132.  
  6133. The  following    bits define  miscellaneous  permissions  used by other
  6134. implementations.
  6135.  
  6136. S_IREAD     is equivalent to S_IRUSR (read permission)
  6137.  
  6138. S_IWRITE    is equivalent to S_IWUSR (write permission)
  6139.  
  6140. S_IEXEC     is equivalent to S_IXUSR (execute/search permission)
  6141.  
  6142. For  example,  if  S_IREAD is  specified,  then reading is not allowed
  6143. (i.e.,    the file is write  only).   If    S_IWRITE  is  specified,  then
  6144. writing is not allowed (i.e., the file is read only).
  6145. ::::UNGETC
  6146. #include \<stdio.h>
  6147. int ungetc( int c, FILE *fp );
  6148.  
  6149. The ungetc  function  pushes the  character specified by "c" back onto
  6150. the input  stream  pointed to by "fp". This character will be returned
  6151. by the next read on the  stream.   The    pushed-back  character will be
  6152. discarded  if a  call  is  made to the    fflush    function  or to a file
  6153. positioning  function (fseek, fsetpos, or rewind) before the next read
  6154. operation is performed.
  6155.  
  6156. Only one character (the most recent one) of pushback is remembered.
  6157.  
  6158. The ungetc function clears the end-of-file indicator, unless the value
  6159. of "c" is EOF.
  6160. ::::UNGETCH
  6161. #include \<conio.h>
  6162. int ungetch( int c );
  6163.  
  6164. The ungetch  function  pushes the character specified by "c" back onto
  6165. the input stream for the console.   This character will be returned by
  6166. the next read from the    console  (with    getch or getche functions) and
  6167. will be  detected  by the  function  kbhit.   Only the last  character
  6168. returned in this way is remembered.
  6169.  
  6170. The ungetch  function  clears the  end-of-file    indicator,  unless the
  6171. value of "c" is EOF.
  6172. ::::UNLINK
  6173. #include \<io.h>
  6174. int unlink( const char *path );
  6175.  
  6176. The unlink  function deletes the file whose name is the string pointed
  6177. to by "path". This function is equivalent to the remove function.
  6178. ::::UNLOCK
  6179. #include \<io.h>
  6180. int unlock( int handle,
  6181.         unsigned long offset,
  6182.         unsigned long nbytes );
  6183.  
  6184. The unlock  function unlocks "nbytes" amount of previously locked data
  6185. in the file  designated  by  "handle" starting at byte "offset" in the
  6186. file.    This  allows  other processes to gain access to this region of
  6187. the file.
  6188.  
  6189. All locked regions of a file must be unlocked before a file is closed.
  6190. ::::UTIME
  6191. #include \<sys\utime.h>
  6192. int utime( const char *path,
  6193.        const struct utimbuf *times );
  6194.  
  6195. struct utimbuf {
  6196.     time_t   actime;    /* access time */
  6197.     time_t   modtime;    /* modification time */
  6198. };
  6199.  
  6200. The utime  function  records the access and modification times for the
  6201. file identified by "path". Write access to this file must be permitted
  6202. for the time to be recorded.
  6203.  
  6204. When the  "times"  argument  is NULL, the  current  time is  recorded.
  6205. Otherwise,  the  argument must point at an object whose type is struct
  6206. utimbuf.   The    modification  time is taken from the modtime  field in
  6207. this structure.
  6208. ::::UTOA
  6209. #include \<stdlib.h>
  6210. char *utoa( unsigned int value,
  6211.         char *buffer,
  6212.         int radix );
  6213.  
  6214. The utoa function  converts the unsigned  binary integer  "value" into
  6215. the  equivalent  string in base "radix" notation storing the result in
  6216. the  character    array  pointed    to by  "buffer".  A null  character is
  6217. appended  to the  result.   The size of "buffer" must be at least (8 *
  6218. sizeof(int) + 1) bytes when converting values in base 2.    That makes
  6219. the size 17 bytes on 16-bit machines, and 33 bytes on 32-bit machines.
  6220. ::::VA_ARG
  6221. #include \<stdarg.h>
  6222. type va_arg( va_list param, type );
  6223.  
  6224. va_arg    is a macro  that can be used to  obtain the next argument in a
  6225. list  of  variable  arguments.     It  must be used with the  associated
  6226. macros va_start and va_end.  A sequence such as
  6227.  
  6228.     va_list curr_arg;
  6229.     type next_arg;
  6230.  
  6231.     next_arg = va_arg( curr_arg, type );
  6232.  
  6233. causes    "next_arg"  to be  assigned  the  value  of the next  variable
  6234. argument.  The type is the type of the argument originally passed.
  6235.  
  6236. The  macro  va_start  must  be    executed  first  in order to  properly
  6237. initialize  the  variable  next_arg  and  the  macro va_end  should be
  6238. executed after all arguments have been obtained.
  6239.  
  6240. The  data  item  curr_arg  is  of  type  va_list  which  contains  the
  6241. information to permit successive acquisitions of the arguments.
  6242. ::::VA_END
  6243. #include \<stdarg.h>
  6244. void va_end( va_list param );
  6245.  
  6246. va_end is a macro used to complete the acquisition of arguments from a
  6247. list  of  variable  arguments.     It  must be used with the  associated
  6248. macros    va_start  and  va_arg.     See  the  description    for va_arg for
  6249. complete documentation on these macros.
  6250. ::::VA_START
  6251. #include \<stdarg.h>
  6252. void va_start( va_list param, previous );
  6253.  
  6254. va_start  is a macro used to start the acquisition of arguments from a
  6255. list of  variable  arguments.    The  "param"  argument    is used by the
  6256. va_arg macro to locate the current acquired argument.    The "previous"
  6257. argument is the argument  that immediately precedes the "..". notation
  6258. in the    original  function  definition.    It  must  be  used with the
  6259. associated  macros  va_arg and va_end.     See the description of va_arg
  6260. for complete documentation on these macros.
  6261. ::::VARIABLE
  6262.             Variable-length Argument Lists
  6263.             ══════════════════════════════
  6264.  
  6265. Variable-length  argument lists are used when a function does not have
  6266. a fixed number of arguments.    These macros provide the capability to
  6267. access these arguments.  The following functions are defined:
  6268.  
  6269. <va_arg>    get next variable argument
  6270. <va_end>    complete access of variable arguments
  6271. <va_start>    start access of variable arguments
  6272. ::::VFPRINTF
  6273. #include \<stdio.h>
  6274. #include \<stdarg.h>
  6275. int vfprintf( FILE *fp,
  6276.           const char *format,
  6277.           va_list arg );
  6278.  
  6279. The  vfprintf  function  writes  output to the file pointed to by "fp"
  6280. under  control    of the    argument  "format".  The  "format"  string  is
  6281. described under the description for printf.   The vfprintf function is
  6282. equivalent  to fprintf,  with the variable argument list replaced with
  6283. "arg," which has been initialized by the va_start macro.
  6284. ::::VFSCANF
  6285. #include \<stdio.h>
  6286. #include \<stdarg.h>
  6287. int vfscanf( FILE *fp,
  6288.          const char *format,
  6289.          va_list arg );
  6290.  
  6291. The  vfscanf  function    scans input from the file  designated  by "fp"
  6292. under  control of the argument    "format". The format list is described
  6293. with the scanf function.
  6294.  
  6295. The vfscanf  function is  equivalent  to the fscanf  function,    with a
  6296. variable argument list replaced with "arg," which has been initialized
  6297. using the va_start macro.
  6298. ::::VPRINTF
  6299. #include \<stdio.h>
  6300. #include \<stdarg.h>
  6301. int vprintf( const char *format, va_list arg );
  6302.  
  6303. The vprintf function writes output to the file stdout under control of
  6304. the  argument  "format".  The "format"    string is described  under the
  6305. description for printf.  The vprintf function is equivalent to printf,
  6306. with the variable  argument  list  replaced with "arg," which has been
  6307. initialized by the va_start macro.
  6308. ::::VSCANF
  6309. #include \<stdio.h>
  6310. #include \<stdarg.h>
  6311. int vscanf( const char *format,
  6312.         va_list arg );
  6313.  
  6314. The vscanf  function  scans input from the file  designated by "stdin"
  6315. under  control of the argument    "format". The format list is described
  6316. with the scanf function.
  6317.  
  6318. The  vscanf  function  is  equivalent  to the scanf  function,    with a
  6319. variable argument list replaced with "arg," which has been initialized
  6320. using the va_start macro.
  6321. ::::VSPRINTF
  6322. #include \<stdio.h>
  6323. #include \<stdarg.h>
  6324. int vsprintf( char *buf,
  6325.           const char *format,
  6326.           va_list arg );
  6327.  
  6328. The  vsprintf  function  formats  data    under  control of the "format"
  6329. control  string and writes the result to "buf". The "format" string is
  6330. described under the description for printf.   The vsprintf function is
  6331. equivalent  to sprintf,  with the variable argument list replaced with
  6332. "arg," which has been initialized by the va_start macro.
  6333. ::::VSSCANF
  6334. #include \<stdio.h>
  6335. #include \<stdarg.h>
  6336. int vsscanf( const char *in_string,
  6337.          const char *format,
  6338.          va_list arg );
  6339.  
  6340. The  vsscanf  function    scans  input  from  the string    designated  by
  6341. "in_string" under control of the argument "format". The format list is
  6342. described with the scanf function.
  6343.  
  6344. The vsscanf  function is  equivalent  to the sscanf  function,    with a
  6345. variable argument list replaced with "arg," which has been initialized
  6346. using the va_start macro.
  6347. ::::WAIT
  6348. #include \<process.h>
  6349. int wait( int *status );
  6350.  
  6351. The  wait  function  suspends  the  calling  process  until any of the
  6352. caller's immediate child processes terminate.
  6353.  
  6354. If  "status"  is not  NULL, it points to a word that will be filled in
  6355. with the  termination  status  word and return    code of the terminated
  6356. child process.
  6357.  
  6358. If the child  process  terminated normally, then the low order byte of
  6359. the status word will be set to 0, and the high order byte will contain
  6360. the low order byte of the return code that the child process passed to
  6361. the DOSEXIT  function.     The DOSEXIT  function is called whenever main
  6362. returns, or exit or _exit are explicity called.
  6363.  
  6364. If the child  process  did not terminate normally, then the high order
  6365. byte of the  status word will be set to 0, and the low order byte will
  6366. contain one of the following values:
  6367.  
  6368. 1    Hard-error abort
  6369.  
  6370. 2    Trap operation
  6371.  
  6372. 3    SIGTERM signal not intercepted
  6373. ::::WCSTOMBS
  6374. #include \<stdlib.h>
  6375. size_t wcstombs( char *s,const wchar_t *pwcs,size_t n );
  6376.  
  6377. The wcstombs function converts a sequence of wide character codes from
  6378. the array pointed to by "pwcs" into a sequence of multibyte characters
  6379. and stores  them in the array pointed to by "s". The wcstombs function
  6380. stops if a  multibyte  character  would  exceed the limit of "n" total
  6381. bytes, or if the null character is stored.    At most "n" bytes of the
  6382. array pointed to by "s" will be modified.
  6383. ::::WCTOMB
  6384. #include \<stdlib.h>
  6385. int wctomb( char *s, wchar_t wchar );
  6386.  
  6387. The  wctomb  function  determines  the    number    of  bytes  required to
  6388. represent the multibyte  character corresponding to the code contained
  6389. in  "wchar".  If "s" is not a NULL  pointer,  the  multibyte character
  6390. representation    is  stored  in the  array  pointed  to by "s". At most
  6391. MB_CUR_MAX characters will be stored.
  6392. ::::WRITE
  6393. #include \<io.h>
  6394. int write( int handle, const char *buffer, int len );
  6395.  
  6396. The write  function  writes data at the  operating system level.   The
  6397. number    of  bytes  transmitted    is  given  by "len" and the data to be
  6398. transmitted is located at the address specified by "buffer".
  6399.  
  6400. The "handle" value is returned by the open function.   The access mode
  6401. must have  included  either  O_WRONLY or O_RDWR when the open function
  6402. was invoked.
  6403.  
  6404. The data is  written  to the file at the end when the file was    opened
  6405. with  O_APPEND    included  as part of the access mode; otherwise, it is
  6406. written at the current file position for the file in question.      This
  6407. file  position can be determined with the tell function and can be set
  6408. with the lseek function.
  6409.  
  6410. When  O_BINARY is included in the access mode, the data is transmitted
  6411. unchanged.   When  O_TEXT is  included in the access mode, the data is
  6412. transmitted with extra carriage return characters inserted before each
  6413. linefeed character encountered in the original data.
  6414. ::::Y0
  6415.  ->BESSEL
  6416. ::::Y1
  6417.  ->BESSEL
  6418. ::::YN
  6419.  ->BESSEL
  6420.