#include #include #include #include #include void main() { int handle; unsigned nbytes; unsigned long offset; auto char buffer[512]; nbytes = 512; offset = 1024; handle = sopen( "db.fil", O_RDWR, SH_DENYNO ); if( handle != -1 ) { lseek( handle, offset, SEEK_SET ); locking( handle, LK_LOCK, nbytes ); read( handle, buffer, nbytes ); /* update data in the buffer */ lseek( handle, offset, SEEK_SET ); write( handle, buffer, nbytes ); lseek( handle, offset, SEEK_SET ); locking( handle, LK_UNLCK, nbytes ); close( handle ); } }