Posts

Showing posts from June, 2017

Density Based traffic control system using Arduino Uno and IR sensors

Image

Linux Programming Basics

In lieu of using lseek() , Linux provides two variants of the read() and write() system calls. Both receive the file position from which to read or write. Upon completion, they do not update the file position. The read form is called pread() : #define _XOPEN_SOURCE 500 #include <unistd.h> ssize_t pread ( int fd , void * buf , size_t count , off_t pos ); This call reads up to count bytes into buf from the file descriptor fd at file position pos . The write form is called pwrite() : #define _XOPEN_SOURCE 500 #include <unistd.h> ssize_t pwrite ( int fd , const void * buf , size_t count , off_t pos ); This call writes up to count bytes from buf to the file descriptor fd at file position pos . These calls are almost identical in behavior to their non- p brethren, except that they completely ignore the current file position; instead of using the current position, they use the value provided by pos . Also, when done, they do not update the file position. In other words, any inter...