ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/preadwrite.c
Revision: 3.1
Committed: Sat Feb 22 02:07:22 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# User Rev Content
1 greg 3.1 #ifndef lint
2     static const char RCSid[] = "$Id$";
3     #endif
4     /*
5     * Substitute routines for pread(2) and pwrite(2)
6     */
7    
8     extern off_t lseek();
9    
10    
11     int
12     pread(fd, buf, siz, offs) /* read buffer from an open file */
13     int fd;
14     char *buf;
15     unsigned int siz;
16     long pos;
17     {
18     if (lseek(fd, (off_t)offs, 0) != offs)
19     return(-1);
20     return(read(fd, buf, siz));
21     /* technically, we should reset pointer here */
22     }
23    
24    
25     int
26     pwrite(fd, buf, siz, offs) /* write buffer to an open file */
27     int fd;
28     char *buf;
29     unsigned int siz;
30     long pos;
31     {
32     if (lseek(fd, (off_t)offs, 0) != offs)
33     return(-1);
34     return(write(fd, buf, siz));
35     /* technically, we should reset pointer here */
36     }