[Date Prev][Date Next] [Chronological] [Thread] [Top]

Fw:ldap_get_values() VS ldap_first_attribute()



I found this sample code on Netscape's web site :

##############################################
"The following section of code gets the first 
value of 
the jpegPhoto attribute and saves the JPEG data to 
a file: 

(...)
/* Find the jpegPhoto attribute. */ 
a = ldap_first_attribute( ld, e, &ber ); 
while ( strcasecmp( a, "jpegphoto" ) != 0 ) { 
a = ldap_next_attribute( ld, e, ber ); 
} 

/* Get the value of the attribute. */ 
if ( ( list_of_photos = 
     ldap_get_values_len( ld, e, a ) ) != NULL ) { 
/* Prepare to write the JPEG data to a file */ 
(...)
##############################################

So my question is :
can't we SKIP the ldap_xxx_attribute() ??  That 
is :

/* Get the value of the attribute. */ 
if ( ( list_of_photos = ldap_get_values_len( ld, 
e, "jpegphoto" ) ) != NULL ) { 
/* Prepare to write the JPEG data to a file */ 
(...)
##############################################

I think the advantage of the 1st code is to allow
"JPEGphoto", "jpegPhoto", etc.
But is it the ONLY one ?



Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,13 ?/mn) ; tél : 08 92 68 13 50 (0,34?/mn)"