This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _pread() _pwrite


pread and pwrite are not in Cygwin (or at least are not exported by 
cygwin1.dll). They are hardly the most portable functions in the world. I 
suggest you write a wrapper. Something like:

<UNTESTED CODE>
ssize_t pread(int fd, void *buf, size_t count, off_t offset)
{
	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
	{
		return(-1);
	}
	return(read(fd, buf, count));
}

and
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
{
	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
	{
		return(-1);
	}
	return(write(fd, buf, count));
}
</UNTESTED CODE>

HTH

rlc

NB: you should of course have configure test for the presence of these 
functions and act accordlingly.. 

On Wed, 25 Jun 2003, Vikram Mehta wrote:

> Hi folks,
> I am compiling some files which need functions like -pread(), pwrite() which
> shud be in libc.a.
> But they are not.
> 
> This file was actually mean to be complied on linux.
> 
> 
> Any ideas how can I overcome this problem
> 
> Vikram
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]