home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Text_Autodocs / dos.doc < prev    next >
Encoding:
Text File  |  1992-09-12  |  24.8 KB  |  1,004 lines

  1. TABLE OF CONTENTS
  2.  
  3. dos.library/Close
  4. dos.library/CreateDir
  5. dos.library/CreateProc
  6. dos.library/CurrentDir
  7. dos.library/DateStamp
  8. dos.library/Delay
  9. dos.library/DeleteFile
  10. dos.library/DeviceProc
  11. dos.library/DupLock
  12. dos.library/Examine
  13. dos.library/Execute
  14. dos.library/Exit
  15. dos.library/ExNext
  16. dos.library/Info
  17. dos.library/Input
  18. dos.library/IoErr
  19. dos.library/IsInteractive
  20. dos.library/LoadSeg
  21. dos.library/Lock
  22. dos.library/Open
  23. dos.library/Output
  24. dos.library/ParentDir
  25. dos.library/Read
  26. dos.library/Rename
  27. dos.library/Seek
  28. dos.library/SetComment
  29. dos.library/SetProtection
  30. dos.library/UnLoadSeg
  31. dos.library/UnLock
  32. dos.library/WaitForChar
  33. dos.library/Write
  34.  
  35.  
  36. dos.library/Close
  37.  
  38.     NAME
  39.     Close -- Close an open file
  40.  
  41.     SYNOPSIS
  42.     Close( file )
  43.            D1
  44.  
  45.     struct FileHandle *file;
  46.  
  47.     FUNCTION
  48.     The file specified by the file handle is closed. You must close all
  49.     files you explicitly opened, but you must not close inherited file
  50.     handles that are passed to you (each filehandle must be closed once
  51.     and ONLY once).
  52.  
  53.     INPUTS
  54.     file - BCPL pointer to a file handle
  55.  
  56.     SEE ALSO
  57.     Open
  58.  
  59.  
  60. dos.library/CreateDir
  61.  
  62.     NAME
  63.     CreateDir -- Create a new directory
  64.  
  65.     SYNOPSIS
  66.     lock = CreateDir( name )
  67.     D0          D1
  68.  
  69.     struct FileLock *lock;
  70.     char *name;
  71.  
  72.     FUNCTION
  73.     CreateDir creates a new directory with the specified name. An error
  74.     is returned if it fails.  Directories can only be created on
  75.     devices which support them, e.g. disks.  A return of zero means
  76.     that AmigaDOS has found an error you should then call IoErr() to
  77.     find out more; otherwise, CreateDir returns an exclusive lock on
  78.     the new directory.
  79.  
  80.     INPUTS
  81.     name - pointer to a null-terminated string
  82.  
  83.     OUTPUTS
  84.     lock - BCPL pointer to a lock
  85.  
  86.  
  87. dos.library/CreateProc
  88.  
  89.     NAME
  90.  
  91.     CreateProc -- Create a new process
  92.  
  93.     SYNOPSIS
  94.     process = CreateProc( name, pri, segment, stackSize )
  95.     D0              D1    D2     D3      D4
  96.  
  97.     struct Process *process;
  98.     char *name;
  99.     LONG pri, stackSize;
  100.     BPTR *segment;
  101.  
  102.     FUNCTION
  103.     CreateProc cretes a new AmigaDOS process of name 'name'.  AmigaDOS
  104.     processes are a superset of exec tasks.
  105.  
  106.     A segment list, as returned by LoadSeg(), is passed as 'seglist'.
  107.     This represents a section of code which is to be run as a new
  108.     process. The code is entered at the first hunk in the segment list,
  109.     which should contain suitable initialization code or a jump to
  110.     such. A process control structure is allocated from memory and
  111.     initialized.  If you wish to fake a segment list (that will never
  112.     have DOS UnLoadSeg() called on it), use this code:
  113.  
  114.             ds.l    0    ;Align to longword
  115.             DC.L    16    ;Segment "length" (faked)
  116.             DC.L    0    ;Pointer to next segment
  117.             ...start of code...
  118.  
  119.     The size of the root stack upon activation is passed as
  120.     'stackSize'.  'pri' specifies the required priority of the new
  121.     process.  The result will be the process identifier of the new
  122.     process, or zero if the routine failed.  The argument 'name'
  123.     specifies the new process name.  A zero return code indicates
  124.     error.
  125.  
  126.     INPUTS
  127.     name - pointer to a null-terminated string
  128.     pri - signed integer
  129.     segment - BCPL pointer to a segment
  130.     stackSize - integer (must be a multiple of 4 bytes)
  131.  
  132.     OUTPUTS
  133.     process - process identifier
  134.  
  135.  
  136. dos.library/CurrentDir
  137.  
  138.     NAME
  139.     CurrentDir -- Make a directory associated with a lock the working directory
  140.  
  141.     SYNOPSIS
  142.     oldLock = CurrentDir( lock )
  143.     D0              D1
  144.  
  145.     struct FileLock *oldlock, *lock;
  146.  
  147.     FUNCTION
  148.     CurrentDir() causes a directory associated with a lock to be made
  149.     the current directory.    The old current directory lock is returned.
  150.  
  151.     A value of zero is a valid result here, this 0 lock represents the
  152.     root of file system that you booted from (which is, in effect, the
  153.     parent of all other file system roots.)
  154.  
  155.     INPUTS
  156.     lock - BCPL pointer to a lock
  157.  
  158.     OUTPUTS
  159.     oldLock - BCPL pointer to a lock
  160.  
  161.     SEE ALSO
  162.     Lock
  163.  
  164.  
  165. dos.library/DateStamp
  166.  
  167.     NAME
  168.     DateStamp -- Obtain the date and time in internal format
  169.  
  170.     SYNOPSIS
  171.     DateStamp( v );
  172.            D1
  173.  
  174.     LONG *v;
  175.  
  176.     FUNCTION
  177.     DateStamp() takes a vector of three longwords that is set to the
  178.     current time. The first element in the vector is a count of the
  179.     number of days. The second element is the number of minutes elapsed
  180.     in the day. The third is the number of ticks elapsed in the current
  181.     minute. A tick happens 50 times a second. DateStamp ensures that
  182.     the day and minute are consistent. All three elements are zero if
  183.     the date is unset. DateStamp() currently only returns even
  184.     multiples of 50 ticks. Therefore the time you get is always an even
  185.     number of ticks.
  186.  
  187.     INPUTS
  188.     v - pointer to an array of three longwords
  189.  
  190.     OUTPUTS
  191.     The array is filled as described.
  192.  
  193.  
  194. dos.library/Delay
  195.  
  196.     NAME
  197.     Delay -- Delay a process for a specified time
  198.  
  199.     SYNOPSIS
  200.     Delay( ticks )
  201.            D1
  202.  
  203.     LONG ticks;
  204.  
  205.     FUNCTION
  206.     The argument 'ticks' specifies how many ticks (50 per second) to
  207.     wait before returning control.
  208.  
  209.     BUGS
  210.     Due to a bug in the timer.device in V1.2/V1.3, specifying a timeout
  211.     of zero for Delay() can cause the unreliable timer & floppy disk
  212.     operation.
  213.  
  214.     INPUTS
  215.     ticks - integer
  216.  
  217.  
  218. dos.library/DeleteFile
  219.  
  220.     NAME
  221.     DeleteFile -- Delete a file or directory
  222.  
  223.     SYNOPSIS
  224.     success = DeleteFile( name )
  225.     D0              D1
  226.  
  227.     BOOL success;
  228.     char *name;
  229.  
  230.     FUNCTION
  231.     This attempts to delete the file or directory specified by 'name'.
  232.     An error is returned if the deletion fails. Note that all the files
  233.     within a directory must be deleted before the directory itself can
  234.     be deleted.
  235.  
  236.     INPUTS
  237.     name - pointer to a null-terminated string
  238.  
  239.     OUTPUTS
  240.     success - boolean
  241.  
  242.     SEE ALSO
  243.     IoErr
  244.  
  245.  
  246. dos.library/DeviceProc
  247.  
  248.     NAME
  249.     DeviceProc -- Return the process I.D. of specific I/O handler
  250.  
  251.     SYNOPSIS
  252.     process = DeviceProc( name )
  253.     D0              D1
  254.  
  255.     FUNCTION
  256.     DeviceProc() returns the process identifier of the process which
  257.     handles the device associated with the specified name. If no
  258.     process handler can be found then the result is zero. If the name
  259.     refers to a file on a mounted device then a pointer to a directory
  260.     lock is returned in IoErr().
  261.  
  262.  
  263. dos.library/DupLock
  264.  
  265.     NAME
  266.     DupLock -- Duplicate a lock
  267.  
  268.     SYNOPSIS
  269.     lock = DupLock( lock )
  270.     D0        D1
  271.  
  272.     struct FileLock *newlock, *lock;
  273.  
  274.     FUNCTION
  275.     DupLock() is passed a shared filing system lock.  This is the ONLY
  276.     way to obtain a duplicate of a lock... simply copying is not
  277.     allowed.
  278.  
  279.     Another lock to the same object is then returned.  It is not
  280.     possible to create a copy of a write lock.
  281.  
  282.     A zero return indicates failure.
  283.  
  284.     INPUTS
  285.     lock - BCPL pointer to a lock
  286.  
  287.     OUTPUTS
  288.     newLock - BCPL pointer to a lock
  289.  
  290.     SEE ALSO
  291.     Lock()
  292.  
  293.  
  294. dos.library/Examine
  295.  
  296.     NAME
  297.     Examine -- Examine a directory or file associated with a lock
  298.  
  299.     SYNOPSIS
  300.     success = Examine( lock, infoBlock )
  301.     D0           D1     D2
  302.  
  303.     BOOL success;
  304.     struct FileLock *lock;
  305.     struct FileInfoBlock *infoBlock
  306.  
  307.     FUNCTION
  308.     Examine() fills in information in the FileInfoBlock concerning the
  309.     file or directory associated with the lock. This information
  310.     includes the name, size, creation date and whether it is a file or
  311.     directory. FileInfoBlock must be longword aligned. Examine() gives
  312.     a return code of zero if it fails.
  313.  
  314.     You may make a local copy of the FileInfoBlock, as long as it is
  315.     never passed back to the operating system.
  316.  
  317.     INPUTS
  318.     lock - BCPL pointer to a lock
  319.     infoBlock - pointer to a FileInfoBlock (must be longword aligned)
  320.  
  321.     OUTPUTS
  322.     success - boolean
  323.  
  324.  
  325. dos.library/Execute
  326.  
  327.     NAME
  328.     Execute -- Execute a CLI command
  329.  
  330.     SYNOPSIS
  331.     success = Execute( commandString, input, output )
  332.     D0           D1          D2     D3
  333.  
  334.     BOOL success
  335.     char *commandString;
  336.     struct FileHandle *input, *output;
  337.  
  338.     FUNCTION
  339.     This function attempts to execute the string commandString as
  340.     though it were a CLI command and arguments. The string can contain
  341.     any valid input that you could type directly in a CLI, including
  342.     input and output redirection using < and >.
  343.  
  344.     The input file handle will normally be zero, and in this case
  345.     Execute() will perform whatever was requested in the commandString
  346.     and then return. If the input file handle is nonzero then after the
  347.     (possibly null) commandString is performed subsequent input is read
  348.     from the specified input file handle until end of that file is
  349.     reached.
  350.  
  351.     In most cases the output file handle must be provided, and is used
  352.     by the CLI commands as their output stream unless output
  353.     redirection was specified. If the output file handle is set to zero
  354.     then the current window, normally specified as *, is used. Note
  355.     that programs running under the Workbench do not normally have a
  356.     current window.
  357.  
  358.     Execute() may also be used to create a new interactive CLI process
  359.     just like those created with the NEWCLI function. In order to do
  360.     this you would call Execute() with an empty commandString, and pass
  361.     a file handle relating to a new window as the input file handle.
  362.     The output file handle would be set to zero. The CLI will read
  363.     commands from the new window, and will use the same window for
  364.     output. This new CLI window can only be terminated by using the
  365.     ENDCLI command.
  366.  
  367.     For this command to work the program RUN must be present in C:.
  368.  
  369.     INPUTS
  370.     commandString - pointer to a null-terminated string
  371.     input - BCPL pointer to a file handle
  372.     output - BCPL pointer to a file handle
  373.  
  374.     OUTPUTS
  375.     success - BOOLEAN indicating whether Execute was successful
  376.           in finding and starting the specified program
  377.  
  378.  
  379. dos.library/Exit
  380.  
  381.     NAME
  382.     Exit -- Exit from a program
  383.  
  384.     SYNOPSIS
  385.     Exit( returnCode )
  386.           D1
  387.  
  388.     LONG returnCode;
  389.  
  390.     FUNCTION
  391.     Exit() is currently for use with programs written as if they
  392.     were BCPL programs.  This function is not normally useful for
  393.     other purposes.
  394.     In general, therefore, please DO NOT CALL THIS FUNCTION!
  395.  
  396.     In order to exit, C programs should use the C language exit()
  397.     function (note the lower case letter "e").  Assembly programs should
  398.     place a return code in D0, and execute an RTS instruction.
  399.  
  400.     IMPLEMENTATION
  401.     The action of Exit() depends on whether the program which called it
  402.     is running as a command under a CLI or not. If the program is
  403.     running under the CLI the command finishes and control reverts to
  404.     the CLI. In this case, returnCode is interpreted as the return code
  405.     from the program.
  406.  
  407.     If the program is running as a distinct process, Exit() deletes the
  408.     process and release the space associated with the stack, segment
  409.     list and process structure.
  410.  
  411.     INPUTS
  412.     returnCode - integer
  413.  
  414.  
  415. dos.library/ExNext
  416.  
  417.     NAME
  418.     ExNext -- Examine the next entry in a directory
  419.  
  420.     SYNOPSIS
  421.     success = ExNext( lock, infoBlock )
  422.     D0          D1    D2
  423.  
  424.     BOOL success;
  425.     struct FileLock *lock;
  426.     struct FileInfoBlock *infoBlock;
  427.  
  428.     FUNCTION
  429.     This routine is passed a directory lock and a FileInfoBlock that
  430.     have been initialized by a previous call to Examine(), or updated
  431.     by a previous call to ExNext.  ExNext gives a return code of zero
  432.     on failure.  The most common cause of failure is reaching the end
  433.     of the list of files in the owning directory.  In this case, IoErr
  434.     will return ERROR_NO_MORE_ENTRIES and a good exit is appropriate.
  435.  
  436.     So, follow these steps to examine a directory:
  437.     1) Pass a Lock and a FileInfoBlock to Examine().  The Lock must
  438.        be on the directory you wish to examine.
  439.     2) Pass ExNext the same Lock and FileInfoBlock.
  440.     3) Do something with the information returned in the FileInfoBlock.  Note
  441.        that the type field is positive for directories, negative for files.
  442.     4) Keep calling ExNext until it returns FALSE.    Check IoErr()
  443.        to ensure that the reason for failure was ERROR_NO_MORE_ENTRIES.
  444.  
  445.     Note: if you wish to recursively scan the file tree and you find
  446.     another directory while ExNext'ing you must Lock that directory and
  447.     Examine() it using a new FileInfoBlock.  Use of the same
  448.     FileInfoBlock to enter a directory would lose important state
  449.     information such that it will be impossible to continue scanning
  450.     the parent directory.  While it is permissible to UnLock and Lock
  451.     the parent directory between ExNext calls, this is not recommended.
  452.     Important state information is associated with the parent lock so
  453.     if it is freed between ExNext calls this information has to be
  454.     rebuilt on each new ExNext call and will significantly slow down
  455.     directory scanning.
  456.  
  457.     It is NOT legal to Examine() a file, and then to ExNext from that
  458.     FileInfoBlock.    You may make a local copy of the FileInfoBlock, as
  459.     long as it is never passed back to the operating system.
  460.  
  461.     INPUTS
  462.     lock - BCPL pointer to a lock originally used for the Examine() call
  463.     infoBlock - pointer to a FileInfoBlock used on the previous Examine()
  464.             or ExNext() call.
  465.  
  466.     OUTPUTS
  467.     success - boolean
  468.  
  469.     SPECIAL NOTE
  470.     The FileInfoBlock must be longword aligned.
  471.  
  472.  
  473. dos.library/Info
  474.  
  475.     NAME
  476.     Info -- Returns information about the disk
  477.  
  478.     SYNOPSIS
  479.     success = Info( lock, parameterBlock )
  480.     D0        D1    D2
  481.  
  482.     struct FileLock *lock;
  483.     struct InfoData *parameterBlock
  484.  
  485.     FUNCTION
  486.     Info() can be used to find information about any disk in use.
  487.     'lock' refers to the disk, or any file on the disk. The parameter
  488.     block is returned with information about the size of the disk,
  489.     number of free blocks and any soft errors.
  490.  
  491.     INPUTS
  492.     lock - BCPL pointer to a lock
  493.     parameterBlock - pointer to an InfoData structure
  494.              (longword aligned)
  495.  
  496.     OUTPUTS
  497.     success - boolean
  498.  
  499.     SPECIAL NOTE:
  500.     Note that InfoData structure must be longword aligned.
  501.  
  502.  
  503. dos.library/IoErr
  504.  
  505.     NAME
  506.     IoErr -- Return extra information from the system
  507.  
  508.     SYNOPSIS
  509.     error = IoErr()
  510.       D0
  511.  
  512.     LONG error;
  513.  
  514.     FUNCTION
  515.     I/O routines return zero to indicate an error. When this happens,
  516.     this routine may be called to determine more information. It is
  517.     also used in some routines to pass back a secondary result.
  518.  
  519.     OUTPUTS
  520.     error - integer
  521.  
  522.     SEE ALSO
  523.     Open, Read, ExNext
  524.  
  525.  
  526. dos.library/Input
  527.  
  528.     NAME
  529.     Input -- Identify the program's initial input file handle
  530.  
  531.     SYNOPSIS
  532.     file = Input()
  533.     D0
  534.  
  535.     struct FileHandle *file;
  536.  
  537.     FUNCTION
  538.     Input() is used to identify the initial input stream allocated when
  539.     the program was initiated.
  540.  
  541.     OUTPUTS
  542.     file - BCPL pointer to a file handle
  543.  
  544.     SEE ALSO
  545.     Output()
  546.  
  547.  
  548. dos.library/IsInteractive
  549.  
  550.     NAME
  551.     IsInteractive -- Discover whether a file is a virtual terminal
  552.  
  553.     SYNOPSIS
  554.     status = IsInteractive( file )
  555.     D0            D1
  556.  
  557.     BOOL status;
  558.     struct FileHandle *file;
  559.  
  560.     FUNCTION
  561.     The return value 'status' indicates whether the file associated
  562.     with the file handle 'file' is connected to a virtual terminal.
  563.  
  564.     INPUTS
  565.     file - BCPL pointer to a file handle
  566.  
  567.     OUTPUTS
  568.     status - boolean
  569.  
  570.  
  571. dos.library/LoadSeg
  572.  
  573.     NAME
  574.     LoadSeg -- Load a load module into memory
  575.  
  576.     SYNOPSIS
  577.     segment = LoadSeg( name )
  578.     D0           D1
  579.  
  580.     BPTR segment;
  581.     char *name;
  582.  
  583.     FUNCTION
  584.     The file 'fileName' should be a load module produced by the linker.
  585.     LoadSeg scatter loads the CODE, DATA and BSS segments into memory,
  586.     chaining together the segments with BPTR's on their first words.
  587.     The end of the chain is indicated by a zero.
  588.  
  589.     In the event of an error any blocks loaded will be unloaded and a
  590.     FALSE (zero) result returned.
  591.  
  592.     If the module is correctly loaded then the output will be a pointer
  593.     at the beginning of the list of blocks. Loaded code is unloaded via
  594.     a call to UnLoadSeg().
  595.  
  596.     INPUTS
  597.     name - pointer to a null-terminated string
  598.  
  599.     OUTPUTS
  600.     segment - BCPL pointer to a segment
  601.  
  602.  
  603. dos.library/Lock
  604.  
  605.     NAME
  606.     Lock -- Lock a directory or file
  607.  
  608.     SYNOPSIS
  609.     lock  = Lock( name, accessMode )
  610.     D0          D1    D2
  611.  
  612.     struct FileLock *lock;
  613.     char *name;
  614.     LONG accessMode;
  615.  
  616.     FUNCTION
  617.     A filing system lock on the file or directory 'name' is returned if
  618.     possible.
  619.  
  620.     If the accessMode is ACCESS_READ, the lock is a shared read lock;
  621.     if the accessMode is ACCESS_WRITE then it is an exclusive write
  622.     lock.
  623.  
  624.     If Lock() fails (that is, if it cannot obtain a filing system lock
  625.     on the file or directory) it returns a zero. Note that the overhead
  626.     for doing a Lock() is less than that for doing an Open(), so that,
  627.     if you want to test to see if a file exists, you should use Lock().
  628.     Of course, once you've found that it exists, you must use Open() if
  629.     you want to open it.
  630.  
  631.     Tricky assumptions about the internal format of a lock are unwise.
  632.  
  633.     INPUTS
  634.     name - pointer to a null-terminated string
  635.     accessMode - integer
  636.  
  637.     OUTPUTS
  638.     lock - BCPL pointer to a lock
  639.  
  640.  
  641. dos.library/Open
  642.  
  643.     NAME
  644.     Open -- Open a file for input or output
  645.  
  646.     SYNOPSIS
  647.     file = Open( name, accessMode )
  648.     D0         D1    D2
  649.  
  650.     struct FileHandle *file;
  651.     char *name;
  652.     LONG accessMode;
  653.  
  654.     FUNCTION
  655.     The named file is opened and a file handle returned.  If the
  656.     accessMode is MODE_OLDFILE, an existing file is opened for reading
  657.     or writing. If the value is MODE_NEWFILE, a new file is created for
  658.     writing. MODE_READWRITE opens an old file with and exclusive lock.
  659.     Open types are documented in the "libraries/dos.h" include file.
  660.  
  661.     The 'name' can be a filename (optionally prefaced by a device
  662.     name), a simple device such as NIL:, a window specification such as
  663.     CON: or RAW: followed by window parameters, or *, representing the
  664.     current window.
  665.  
  666.     If the file cannot be opened for any reason, the value returned
  667.     will be zero, and a secondary error code will be available by
  668.     calling the routine IoErr().
  669.  
  670.     INPUTS
  671.     name - pointer to a null-terminated string
  672.     accessMode - integer
  673.  
  674.     OUTPUTS
  675.     file - BCPL pointer to a file handle
  676.  
  677.  
  678. dos.library/Output
  679.  
  680.     NAME
  681.     Output -- Identify the programs' initial output file handle
  682.  
  683.     SYNOPSIS
  684.     file = Output()
  685.     D0
  686.  
  687.     struct FileHandle *file;
  688.  
  689.     FUNCTION
  690.     Output() is used to identify the initial output stream allocated
  691.     when the program was initiated.
  692.  
  693.     OUTPUTS
  694.     file - BCPL pointer to a file handle
  695.  
  696.  
  697. dos.library/ParentDir
  698.  
  699.     NAME
  700.     ParentDir -- Obtain the parent of a directory or file
  701.  
  702.     SYNOPSIS
  703.     newlock = ParentDir( lock )
  704.     D0             D1
  705.  
  706.     struct FileLock *newlock, *lock;
  707.  
  708.     FUNCTION
  709.     The argument 'lock' is associated with a given file or directory.
  710.     ParentDir() returns 'newlock' which is associated the parent
  711.     directory of 'lock'.
  712.  
  713.     Taking the ParentDir() of the root of the current filing system
  714.     returns a NULL (0) lock.  Note this 0 lock represents the root of
  715.     file system that you booted from (which is, in effect, the parent
  716.     of all other file system roots.)
  717.  
  718.     INPUTS
  719.     lock - BCPL pointer to a lock
  720.  
  721.     OUTPUTS
  722.     newlock - BCPL pointer to a lock
  723.  
  724.  
  725. dos.library/Read
  726.  
  727.     NAME
  728.     Read -- Read bytes of data from a file
  729.  
  730.     SYNOPSIS
  731.     actualLength = Read( file, buffer, length )
  732.     D0             D1    D2       D3
  733.  
  734.     LONG actualLength;
  735.     struct FileHandle *file;
  736.     char *buffer;
  737.     LONG length;
  738.  
  739.     FUNCTION
  740.     Data can be copied using a combination of Read() and Write().
  741.     Read() reads bytes of information from an opened file (represented
  742.     here by the argument 'file') into the buffer given. The argument
  743.     'length' is the length of the buffer given.
  744.  
  745.     The value returned is the length of the information actually read.
  746.     So, when 'actualLength' is greater than zero, the value of
  747.     'actualLength' is the the number of characters read. Usually Read
  748.     will try to fill up your buffer before returning. A value of zero
  749.     means that end-of-file has been reached. Errors are indicated by a
  750.     value of -1. In any case, the value of IoErr() is also modified by
  751.     this call. If there was an error it gives more error information,
  752.     otherwise it indicates whether there is any more data in the file.
  753.  
  754.     INPUTS
  755.     file - BCPL pointer to a file handle
  756.     buffer - pointer to buffer
  757.     length - integer
  758.  
  759.     OUTPUTS
  760.     actualLength - integer
  761.  
  762.  
  763. dos.library/Rename
  764.  
  765.     NAME
  766.     Rename -- Rename a directory or file
  767.  
  768.     SYNOPSIS
  769.     success = Rename( oldName, newName )
  770.     D0          D1       D2
  771.  
  772.     BOOL success;
  773.     char *oldName, *newName;
  774.  
  775.     FUNCTION
  776.     Rename() attempts to rename the file or directory specified as
  777.     'oldName' with the name 'newName'. If the file or directory
  778.     'newName' exists, Rename() fails and returns an error. Both
  779.     'oldName' and the 'newName' can contain a directory specification.
  780.     In this case, the file will be moved from one directory to another.
  781.  
  782.     Note: it is impossible to Rename() a file from one volume to
  783.     another.
  784.  
  785.     INPUTS
  786.     oldName - pointer to a null-terminated string
  787.     newName - pointer to a null-terminated string
  788.  
  789.     OUTPUTS
  790.     success - boolean
  791.  
  792.  
  793. dos.library/Seek
  794.  
  795.     NAME
  796.     Seek -- Find and point at the logical position in a file
  797.  
  798.     SYNOPSIS
  799.     oldPosition = Seek( file, position, mode )
  800.     D0            D1      D2        D3
  801.  
  802.     LONG oldPosition, position, mode;
  803.     struct FileHandle *file;
  804.  
  805.     FUNCTION
  806.     Seek() sets the read/write cursor for the file 'file' to the
  807.     position 'position'. This position is used by both Read() and
  808.     Write() as a place to start reading or writing. The result is the
  809.     current absolute position in the file, or -1 if an error occurs, in
  810.     which case IoErr() can be used to find more information. 'mode' can
  811.     be OFFSET_BEGINNING, OFFSET_CURRENT or OFFSET_END. It is used to
  812.     specify the relative start position. For example, 20 from current
  813.     is a position 20 bytes forward from current, -20 is 20 bytes back
  814.     from current.
  815.  
  816.     So that to find out where you are, seek zero from current. The end
  817.     of the file is a Seek() positioned by zero from end. You cannot
  818.     Seek() beyond the end of a file.
  819.  
  820.     INPUTS
  821.     file - BCPL pointer to a file handle
  822.     position - integer
  823.     mode - integer
  824.  
  825.     OUTPUTS
  826.     oldPosition - integer
  827.  
  828.  
  829. dos.library/SetComment
  830.  
  831.     NAME
  832.     SetComment -- Change a files' comment string
  833.  
  834.     SYNOPSIS
  835.     success = SetComment( name, comment )
  836.     D0              D1    D2
  837.  
  838.     BOOL success;
  839.     char *name;
  840.     char *comment;
  841.  
  842.     FUNCTION
  843.     SetComment() sets a comment on a file or directory. The comment is
  844.     a pointer to a null-terminated string of up to 80 characters.
  845.  
  846.     INPUTS
  847.     name - pointer to a null-terminated string
  848.     comment - pointer to a null-terminated string
  849.  
  850.  
  851. dos.library/SetProtection
  852.  
  853.     NAME
  854.     SetProtection -- Set protection for a file or directory
  855.  
  856.     SYNOPSIS
  857.     success = SetProtection( name, mask )
  858.     D0             D1    D2:4
  859.  
  860.     BOOL success;
  861.     char *name;
  862.     LONG mask;
  863.  
  864.     FUNCTION
  865.     SetProtection() sets the protection attributes on a file or
  866.     directory. The lower bits of the mask are as follows:
  867.  
  868.     Bits 31-4 Reserved.
  869.     bit 4: 1 = file has not changed     0 = file has been changed
  870.     bit 3: 1 = reads not allowed,        0 = reads allowed.
  871.     bit 2: 1 = writes not allowed,        0 = writes allowed.
  872.     bit 1: 1 = execution not allowed,    0 = execution allowed.
  873.     bit 0: 1 = deletion not allowed,    0 = deletion allowed.
  874.  
  875.     Only delete is checked for by the Old Filing System.  The archive
  876.     bit is cleared by the file system whenever the file is changed.
  877.     Backup utilities will generally set the bit after backing up
  878.     each file.
  879.  
  880.     The new Fast Filing System looks at the read and write bits, and
  881.     the Shell looks at the execute bit, and will refuse to start
  882.     a file as a binary executable if it is set.
  883.  
  884.     Other bits may will be defined in the "libraries/dos.h" include
  885.     files.    Rather than referring to bits by number you should use the
  886.     definitions in "dos.h".
  887.  
  888.     INPUTS
  889.     name - pointer to a null-terminated string
  890.     mask - the protection mask required
  891.  
  892.     OUTPUTS
  893.     success - boolean
  894.  
  895.  
  896. dos.library/UnLoadSeg
  897.  
  898.     NAME
  899.     UnLoadSeg -- Unload a segment previously loaded by LoadSeg()
  900.  
  901.     SYNOPSIS
  902.     error = UnLoadSeg( segment )
  903.     D0           D1
  904.  
  905.     BOOL error;
  906.     BPTR segment;
  907.  
  908.     FUNCTION
  909.     Unload a segment loaded by LoadSeg().  'segment' may be zero.
  910.  
  911.     INPUTS
  912.     segment - BCPL pointer to a segment identifier
  913.  
  914.     OUTPUTS
  915.     error - boolean
  916.  
  917.  
  918. dos.library/UnLock
  919.  
  920.     NAME
  921.     UnLock -- Unlock a directory or file
  922.  
  923.     SYNOPSIS
  924.     UnLock( lock )
  925.         D1
  926.  
  927.     struct FileLock *lock;
  928.  
  929.     FUNCTION
  930.     The filing system lock [obtained from Lock(), DupLock(), or
  931.     CreateDir()] is removed and deallocated.
  932.  
  933.     INPUTS
  934.     lock - BCPL pointer to a lock
  935.  
  936.     NOTE
  937.     passing zero to UnLock() is harmless
  938.  
  939.  
  940. dos.library/WaitForChar
  941.  
  942.     NAME
  943.     WaitForChar -- Determine if chars arrive within a time limit
  944.  
  945.     SYNOPSIS
  946.     status = WaitForChar( file, timeout )
  947.     D0              D1    D2
  948.  
  949.     BOOL status;
  950.     struct FileHandle *file;
  951.     LONG timeout;
  952.  
  953.     FUNCTION
  954.     If a character is available to be read from 'file' within a the
  955.     time (in microseconds) indicated by 'timeout', WaitForChar()
  956.     returns -1 (TRUE). If a character is available, you can use Read()
  957.     to read it.  Note that WaitForChar() is only valid when the I/O
  958.     stream is connected to a virtual terminal device. If a character is
  959.     not available within 'timeout', a 0 (FALSE) is returned.
  960.  
  961.     BUGS
  962.     Due to a bug in the timer.device in V1.2/V1.3, specifying a timeout
  963.     of zero for WaitForChar() can cause the unreliable timer & floppy
  964.     disk operation.
  965.  
  966.     INPUTS
  967.     file - BCPL pointer to a file handle
  968.     timeout - integer
  969.  
  970.     OUTPUTS
  971.     status - boolean
  972.  
  973.  
  974. dos.library/Write
  975.  
  976.     NAME
  977.     Write -- Write bytes of data to a file
  978.  
  979.     SYNOPSIS
  980.     returnedLength =  Write( file, buffer, length )
  981.     D0             D1    D2      D3
  982.  
  983.     LONG returnedLength;
  984.     struct FileHandle *file;
  985.     char *buffer;
  986.     LONG length;
  987.  
  988.     FUNCTION
  989.     Write() writes bytes of data to the opened file 'file'. 'length'
  990.     indicates the length of data to be transferred; 'buffer' is a
  991.     pointer to the buffer. The value returned is the length of
  992.     information actually written. So, when 'length' is greater than
  993.     zero, the value of 'length' is the number of characters written.
  994.     Errors are indicated by a value of -1.
  995.  
  996.     INPUTS
  997.     file - BCPL pointer to a file handle
  998.     buffer - pointer to the buffer
  999.     length - integer
  1000.  
  1001.     OUTPUTS
  1002.     returnedLength - integer
  1003.  
  1004.