home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / reference / amiga_mail_vol2 / ii-107 / asyncio.h < prev    next >
C/C++ Source or Header  |  1993-05-19  |  3KB  |  79 lines

  1. /* (c)  Copyright 1993 Commodore-Amiga, Inc.   All rights reserved. */
  2. /* The information contained herein is subject to change without    */
  3. /* notice, and is provided "as is" without warranty of any kind,    */
  4. /* either expressed or implied.  The entire risk as to the use of   */
  5. /* this information is assumed by the user.                         */
  6.  
  7. #ifndef ASYNCIO_H
  8. #define ASYNCIO_H
  9.  
  10.  
  11. /*****************************************************************************/
  12.  
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include <exec/types.h>
  16. #endif
  17.  
  18. #ifndef EXEC_PORTS_H
  19. #include <exec/ports.h>
  20. #endif
  21.  
  22. #ifndef DOS_DOS_H
  23. #include <dos/dos.h>
  24. #endif
  25.  
  26.  
  27. /*****************************************************************************/
  28.  
  29.  
  30. /* This structure is public only by necessity, don't muck with it yourself, or
  31.  * you're looking for trouble
  32.  */
  33. struct AsyncFile
  34. {
  35.     BPTR                  af_File;
  36.     ULONG                 af_BlockSize;
  37.     struct MsgPort       *af_Handler;
  38.     APTR                  af_Offset;
  39.     LONG                  af_BytesLeft;
  40.     ULONG                 af_BufferSize;
  41.     APTR                  af_Buffers[2];
  42.     struct StandardPacket af_Packet;
  43.     struct MsgPort        af_PacketPort;
  44.     ULONG                 af_CurrentBuf;
  45.     ULONG                 af_SeekOffset;
  46.     UBYTE                 af_PacketPending;
  47.     UBYTE                 af_ReadMode;
  48. };
  49.  
  50.  
  51. /*****************************************************************************/
  52.  
  53.  
  54. #define MODE_READ   0  /* read an existing file                             */
  55. #define MODE_WRITE  1  /* create a new file, delete existing file if needed */
  56. #define MODE_APPEND 2  /* append to end of existing file, or create new     */
  57.  
  58. #define MODE_START   -1   /* relative to start of file         */
  59. #define MODE_CURRENT  0   /* relative to current file position */
  60. #define MODE_END      1   /* relative to end of file         */
  61.  
  62.  
  63. /*****************************************************************************/
  64.  
  65.  
  66. struct AsyncFile *OpenAsync(const STRPTR fileName, UBYTE accessMode, LONG bufferSize);
  67. LONG CloseAsync(struct AsyncFile *file);
  68. LONG ReadAsync(struct AsyncFile *file, APTR buffer, LONG numBytes);
  69. LONG ReadCharAsync(struct AsyncFile *file);
  70. LONG WriteAsync(struct AsyncFile *file, APTR buffer, LONG numBytes);
  71. LONG WriteCharAsync(struct AsyncFile *file, UBYTE ch);
  72. LONG SeekAsync(struct AsyncFile *file, LONG position, BYTE mode);
  73.  
  74.  
  75. /*****************************************************************************/
  76.  
  77.  
  78. #endif /* ASYNCIO_H */
  79.