ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/preadwrite.c
Revision: 3.3
Committed: Fri Nov 5 03:31:36 2004 UTC (19 years, 6 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 3.2: +1 -1 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Removed unused programs and files from distribution (sources to CVS attic)

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: preadwrite.c,v 3.2 2003/10/20 16:01:55 greg Exp $";
3 #endif
4 /*
5 * Substitute routines for pread(2) and pwrite(2)
6 */
7
8 #include "platform.h"
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 offs;
17 {
18 if (lseek(fd, (off_t)offs, SEEK_SET) != 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 offs;
31 {
32 if (lseek(fd, (off_t)offs, SEEK_SET) != offs)
33 return(-1);
34 return(write(fd, buf, siz));
35 /* technically, we should reset pointer here */
36 }