Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_b_scan( <cmask>, <ntype> [, <aobjects> [, <atypes> ] ] ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_B_SCAN( <cMask>, <nType> [, <aObjects> [, <aTypes> ] ] )


Parameters

<cMask>
Character mask to use in searching for matching object names.

<nType>
Type of object to search for.

<aObjects>
Array to receive object names found.

<aTypes>
Array to receive object types found.


Returns

Number of matching objects.

Call N_B_SCAN(<cMask>, <nType>) to size the arrays before passing them 
in a second call to N_B_SCAN().

Clipper 5.x  If you initialize the arrays to zero elements, the 
function will resize them. Thus you need make only one call, not two. 
For instance:

LOCAL aUsers := {}
N_B_SCAN( '*', 1, aUsers )



Description

N_B_SCAN(<cMask>, <nType>, <aObjects>) fills the array <aObjects> with 
a list of names of matching the search mask in <cMask>.

N_B_SCAN(<cMask>, <nType>, <aObjects>, <aTypes>) returns a list of 
matching objects in the first array and their types in the second 
array. This is useful if you are scanning for all object types (-1).

<cMask> can be up to 48 characters long and may use wildcards (* and 
?).

Note  Object names may contain any character except \ / : ; , * ?  
and embedded spaces.

<nType> is the object type.

Value    Object type
-1       Wild card (permitted only in searches)
 0       Undefined
 1       User
 2       Group
 3       Print queue
 4       File server
 6       Gateway
 7       Print server
38       Remote bridge

The wild card type (-1) permits scanning for objects of any type. The 
following code would return the number of objects of all types 
beginning with the letter S.

N_B_SCAN( 'S*', -1 )


Examples

// Display all users beginning with 'T'
DECLARE aUsers[N_B_SCAN('T*', 1)]
N_B_SCAN('T*', 1, aUsers)
ACHOICE(nTop, nLeft, nBottom, nRight, aUsers)

// Display all available print queues
DECLARE aQueues[N_B_SCAN('*', 3 )]
N_B_SCAN('*', 3, aQueues)
ACHOICE(nTop, nLeft, nBottom, nRight, aQueues)

// Return a list of print queue users
FUNCTION GetQUsers( cQueue )
   LOCAL aQUsers := {}
   // If queue exists...
   IF N_B_SCAN(cQueue, 3) > 0
      // fill the array.
      N_B_MEMBERS(cQueue, 3, 'Q_USERS', @aQUsers)
   ENDIF
RETURN aQUsers



See Also: N_B_PRSCAN() N_B_TYPE()

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