Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>lock() set file sharing locks</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
lock()                   Set File Sharing Locks

 #include   <io.h>

 int        lock(handle,offset,length);
 int        handle;                      Handle associated with file
 long       offset;                      Location of area to be locked
 long       length;                      Length of area to be locked

    lock() locks an area of the file associated with 'handle', starting
    at the position 'offset' and proceeding for 'length' bytes.  Locking
    bytes in a file prevents subsequent reading and writing of those
    bytes by other processes.  No overlapping regions can be locked.  A
    program trying to read or write into a locked region will retry the
    operation three times.  If all three retries fail, the call fails
    with an error.

    lock() must be removed before closing a file.  A program must release
    all locks before completing.

    Returns:    0 is returned on success; -1 is returned on error.

      Notes:    lock() is unique to MS-DOS 3.x.  Older versions do not
                support this call.

See Also: open() unlock()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson