Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FlexFile Reference Guide - <b>v_exclusiv()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 V_EXCLUSIV()
 Establish exclusive or shared use of a DBV type file
-------------------------------------------------------------------------------

 Syntax

    V_EXCLUSIV( <lToggle> )  ->    lSetting

 Arguments

    <lToggle> is a logical value. If <lToggle> is (.T.), then
    subsequent files opened with V_USE() will be opened exclusively.

    If <lToggle> is (.F.), then subsequent files opened with V_USE()
    will be opened in shared mode.

 Returns

    The current setting of V_EXCLUSIV().

 Description

    In a network environment, V_EXCLUSIV() determines whether the
    V_USE() function specified without the <lExclusive> parameter will
    be opened in shared or exclusive mode. If <lToggle> is (.T.) (the
    default), other users cannot V_USE() the same file until it has
    been closed.

    If <lToggle> is (.F.), all subsequent files opened by V_USE() without the
    <lExclusive> parameter will be opened in shared mode. Access by
    other users must be controlled programmatically. Typically, this
    can be done with Clipper's RLOCK() and FLOCK() functions. That is,
    if the pointer to a DBV is kept in a DBF file, then RLOCK()ing the
    record containing the pointer will prevent other users from
    accessing that field.

    Refer to Network Programming for more information.

 Notes

  . Error handling: Attempting to V_USE() a file which has been
    opened exclusively by another user causes V_USE() to return a -1.
    V_ERROR() will return an error code indicating this condition.

 Examples

    // Set up the environment so that all files are opened
    // in shared mode.
    #define EXCLUSIVE (.T.)
    V_EXCLUSIV( !EXCLUSIVE )

    // This file will be opened in shared mode.
    IF V_USE( "mainfile" ) == -1
       ? "Error: " + str( V_ERROR(), 4 )
       QUIT
    ENDIF

    // This V_USE() overrides the global V_EXCLUSIV() setting
    // and opens the file exclusively.
    V_USE( "tempfile", , "NEW", EXCLUSIVE )

    // Close all files.
    V_CLOSEALL()

See Also: V_USE() Network Programming

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