
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Novlib 3.30 Online Reference - <b> filopnconlst()</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
FilOpnConLst()
------------------------------------------------------------------------------
Purpose:
Get a list of connections with an open file.
Syntax:
wConnection = FilOpnConLst( 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).
Description:
FilOpnConLst() is used to obtain a list of workstation connection
numbers that have a specific file open.
FilOpnConLst() 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 FilOpnConLst() returns NOVERRINT and NWErrorGet()
is set to 255, this means that no one is using the file. If
FilOpnConLst() 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. FilOpnConLst() should be called
again repeatedly, incrementing the index each time. FilOpnConLst() 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 FilOpnConLst(), 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.
FilOpnConLst() returns NOVERRINT if an error occurs.
Example:
// The following example program shows how to use FilOpnConLst()
// 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 = FilOpnConLst( lpszFullPath, iCounter )
do case
case NWErrorGet() = -255
? "File, ", lpszFullPath, " is opened Exclusively by user "
?? WSLogNmeGet( 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", WSLogNmeGet( wStationNum )
?? "at station", wStationNum
else
?
? "End"
exit
endif
iCounter++
wStationNum = FilOpnConLst( lpszFullPath, iCounter )
enddo
endcase
Notes:
This function requires that the requesting user has console
operator rights.
See Also: FilOpnFilLst()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson