This is the mail archive of the
cygwin
mailing list for the Cygwin project.
question about pread() while reading /dev/sdb
- From: <joso at post dot cz>
- To: <cygwin at cygwin dot com>
- Date: Tue, 06 Jun 2017 19:27:13 +0200 (CEST)
- Subject: question about pread() while reading /dev/sdb
- Authentication-results: sourceware.org; auth=none
Hello, I'm porting tool from Linux envirmnment to Windows Cygwin.
I'm unable to get correct data from pread() while reading /dev/sdx
On Linux it works as expected, under Cygwin I receive uncorrect data.
I have isolated the problem with the following program:
#include stdio.h
#include sys/types.h
#include sys/stat.h
#include fcntl.h
#include unistd.h
int main(int argc, char *argv[])
{
unsigned char sbuff[512];
int f1;
f1=open(argv[1], O_RDWR);
pread(f1, sbuff, 512, 0);
for(int i=0; i 512; i++) printf("%x ",sbuff[i]);
close(f1);
}
If the argument is regular file it works. But if the argument is /dev/sdb it does not provide correct data. The shell is run under Administrator permission.
Thank you for your opinion.
Josef
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple