Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Novlib 3.30 Online Reference - <b> filopenconnlist()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FilOpenConnList()
------------------------------------------------------------------------------
 Purpose:
 Get a list of connections with an open file.

 Syntax:
 wConnection = FilOpenConnList( lpszPath, iIndex)

 Parameters:
 lpszPath The full NetWare path of the file.
 iIndex   The index into the list of connections that have lpszPath open.

 Returns:
 A numeric value (unsigned short int).

 The CA-Clipper name for this function is:
 FilOpnConLst().

 Description:
 FilOpenConnList() is used to obtain a list of workstation connection
 numbers that have a specific file open.

 FilOpenConnList() is called with lpszPath as the first parameter, set to
 the full path including the volume name and the filename e.g.
 "SYS:\PUBLIC\MYFILE.DBF". The index number iIndex is initially set to 1 and
 incremented with each subsequent call.

 On the first call, if FilOpenConnList() returns NOVERRINT and NWErrorGet()
 is set to 255, this means that no one is using the file. If
 FilOpenConnList() returns a positive number, this is the connection number
 of a station that has this file open.

 If NWErrorGet() is set to 0 the file is opened in shared mode, so other
 users may also have this file open. FilOpenConnList() should be called
 again repeatedly, incrementing the index each time. FilOpenConnList() will
 return another station number that has this file open until NOVERRINT is
 returned and NWErrorGet() returns 255, indicating that there are no more
 workstations with this file open.

 If, on the first call to FilOpenConnList(), a valid workstation number is
 returned, but NWErrorGet() is set to -255, this workstation has the file
 opened exclusively so no other workstations can have this file open.

 FilOpenConnList() returns NOVERRINT if an error occurs.

 Example:
 // The following example program shows how to use FilOpenConnList()
 // to return a list of the connections with a specific file open:
 // PARAMETERS NameStr
 // File name string

 iCounter = 1
 lpszFullPath = "SYS:" + upper( curdir() ) + "\" + upper( NameStr )
 wStationNum = FilOpenConnList( lpszFullPath, iCounter )
 do case
    case NWErrorGet() = -255
       ? "File, ", lpszFullPath, " is opened Exclusively by user "
       ?? WSLoginNameGet( wStationNum ), "at station", wStationNum
    case wStationNum = NOVERRINT
       ? "File", lpszFullPath, " is not open by any users."
    otherwise
       ? "Users who currently have", lpszFullPath, "open:"
       ?
       do while TRUE
          if wStationNum != NOVERRINT
             ? "User", WSLoginNameGet( wStationNum )
             ??  "at station", wStationNum
          else
             ?
             ? "End"
             exit
          endif
          iCounter++
          wStationNum = FilOpenConnList( lpszFullPath, iCounter )
        enddo
 endcase

 Notes:
 This function requires that the requesting user has console
 operator rights.

See Also: FilOpenFileList()

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