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_prread( <cobject>, <ntype>, <cproperty> ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_B_PRREAD( <cObject>, <nType>, <cProperty> )


Parameters

<cObject>
Name of an object.

<nType>
Object type.

<cProperty>
Name of a property of the object.


Returns

Value of the property in a 128-byte string.

If the property does not exist, or if the current user does not have 
the correct read access, returns a null string.


Description

The parameter <nType> specifies the type of the object whose property 
you want to read. Object types are:

Value         Object type
 1            User
 2            Group
 3            Print queue
 4            File server
 6            Gateway
 7            Print server
38            Remote bridge

<cProperty> specifies the name of the property you want to read. Not 
all objects have all properties.You can use N_B_PRSCAN() to list the 
properties owned by an object.

The best method for reading the value of a property will depend on 
whether it is an item or a set property. (UseN_B_PRTYPE() to determine 
a property's type.)

If the property is a set property, the 128-byte string returned by 
N_B_PRREAD() will contain a list of IDs for objects that are members of 
the set. It will probably be more useful to use N_B_MEMBERS() to 
explode the set into an array containing the names of member objects.

If the property is an item property, the format of the 128-byte string 
returned by N_B_PRREAD() depends on the definition used when data was 
written to the property. It is likely that not all bytes will contain 
data. The property NET_ADDRESS, for example, contains only 12 bytes of 
information; the remaining 116 bytes are undefined.

Commonly used item properties are:

Item Property           Description
ACCOUNT_BALANCE         User's usage balance on server for 
                        various services.

IDENTIFICATION          Full name (usually attached to user
                        or group objects).

NET_ADDRESS             Twelve-byte Internet address 
                        (usually attached to server
                        objects).

PASSWORD                Generally encrypted.

Q_DIRECTORY             Path to a print queue. Must be less 
                        than 128 characters.


Example

// Return the full name of an object
FUNCTION GetName( cObject, nType )
   LOCAL cName
   // If the object exists...
   IF N_B_SCAN(cObject, nType) > 0
      // read the appropriate property.
      cName = N_B_PRREAD(cObject, nType, 'IDENTIFICATION')
      IF EMPTY(cName)
         // No fullname assigned
         RETURN 'None'
      ELSE
         // Fullname is variable length
         // trailed by null byte - CHR(0)
         RETURN SUBSTR(cName, 1, AT(CHR(0), cName) - 1)
      ENDIF
   ENDIF
   // Object does not exist.
RETURN NIL



See Also: N_B_MEMBERS() N_B_PRSCAN() N_B_PRTYPE() N_B_PRWRITE()

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