home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / communic / inetutils / contrib / amipop18.lha / AmiPOP18 / source / asyncio.h < prev    next >
C/C++ Source or Header  |  1994-02-28  |  2KB  |  73 lines

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