home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff384.lzh / NorthC / Example1.LZH / clibs / UNIX / README < prev    next >
Text File  |  1990-08-30  |  3KB  |  106 lines

  1.  
  2.   (c) 1990 S.Hawtin.
  3.   Permission is granted to copy this file provided
  4.    1) It is not used for commercial gain
  5.    2) This notice is included in all copies
  6.    3) Altered copies are marked as such
  7.  
  8.   No liability is accepted for the contents of the file.
  9.  
  10.   README        within          Public Domain UNIX.lib
  11.  
  12.  
  13.  
  14.   This directory contains the source for the "UNIX" library, this 
  15. implements a few UNIX type functions that are missing from the standard 
  16. 'C' library.
  17.  
  18.   This set of functions follows the older style of file interface for 'C', 
  19. I have included them because you may find a program that needs to call 
  20. these lower level functions to manipulate files.
  21.  
  22.   To use any of these functions you should include the file "unix.h" in 
  23. your source and link the program with a command such as
  24.  
  25.     prog1:  foo.o bar.o baz.o
  26.             blink with $*.blink LIB jim:libs/libUNIX.a
  27.  
  28. in you Makefile, this tells the linker to look in "jim:libs/libUNIX.a" for 
  29. any functions that are used but not defined.
  30.  
  31.   The functions in the library are not quite the same as the UNIX or MSDOS 
  32. functions but they are near enough to work.  Once you have your program 
  33. up and running you should change it over to use the ANSI functions, you will 
  34. find it easier to move the program later.
  35.  
  36.   The functions in this library are:
  37.  
  38. int close(handle)
  39.     APTR handle;
  40.  
  41.   Close the file, this will call the AmigaDOS function Close() on the file 
  42. handle, the value returned will be from Close().
  43.  
  44. APTR creat(name,mode)
  45.     char *name;
  46.     int  mode;
  47.  
  48.   Open the named file, this function will create a new file even if one 
  49. already existed with the given name.  This function calls the AmigaDOS 
  50. Open() function.
  51.  
  52. unsigned int getw(fptr)
  53.     FILE *fptr;
  54.  
  55.   Get the next word from the file, this will just treat the next two bytes 
  56. in the file as an integer.  Beware when reading files that were written on 
  57. other machines, for example on the IBM PC, the byte order can make a 
  58. difference.
  59.  
  60. long lseek(handle,offset,whence)
  61.     APTR handle;
  62.     long offset;
  63.     int  whence;
  64.  
  65.   Move the current location within a file, this calls the AmigaDOS Seek() 
  66. function.  Note the value of whence uses the UNIX values of 0 1 and 2 not 
  67. the values defined in <stdio.h>.
  68.  
  69. APTR open(name,mode)
  70.     char *name;
  71.     int  mode;
  72.  
  73.   Open a file, this function will either open a new file or an existing file.  
  74. The function of course uses the AmigaDOS Open() function.
  75.  
  76. int putw(val,fptr)
  77.     int val;
  78.     FILE *fptr;
  79.  
  80.   Put a short word into the file, if you intend to transfer files to other 
  81. machines then beware of the byte order of your processor.
  82.  
  83. int read(handle,buf,count)
  84.     APTR handle;
  85.     char *buf;
  86.     int  count;
  87.  
  88.   Read a block of data from the file into an area of memory.  Again the byte 
  89. order may mess you up with foreign files.  Not this is an unbuffered read.
  90.  
  91. long tell(handle)
  92.     APTR handle;
  93.  
  94.   Return the current location of the pointer in the buffer, this is given 
  95. in terms of the number of bytes from the start of the file.
  96.  
  97. int write(handle,buf,count)
  98.     APTR handle;
  99.     char *buf;
  100.     int  count;
  101.  
  102.   Write a block of data from memory to the file, this function uses the 
  103. AmigaDOS Write() function.
  104.  
  105.  
  106.