Mit UF_ATTR_ask_part_attrs_in_file können PART-Attribute ausgelesen werden.
Leider kann ich die Feld-Struktur der Attribute nich auslesen, da mir der Strukturaufbau unklar ist.
Nachfolgend der Quellcode:
/*****************************************************************************
** lesen der Attribute
*****************************************************************************/
static void read_file_attr()
Anfang
/* Variable Declarations */
FILE *datei_lesen;
int n_attributes;
int i;
char attr_title[UF_ATTR_MAX_TITLE_LEN]=" ";
char attribute_wert[UF_ATTR_MAX_STRING_LEN]=" ";
UF_ATTR_part_attr_p_t *attributes;
/*
UF_ATTR_part_attr_p_t * attributes Output to be freed Allocated array of structures holding
attribute titles and values. This must be freed by the caller using UF_free.
*/
// Umgebungsvariablen holen .....
get_System_ENVDaten();
// Zeichnungsdaten
strcpy(dat_in, ZV_Pfad);
strcat(dat_in,"\\FileAttribute.dat");
// --- Kopfdaten laden .....
fehler =0;
if(( datei_lesen = fopen(dat_in,"rt") ) gleich FALSCH) {
sprintf(msg, "FEHLER:read_file_attr(): FileAttribute.dat\n\r");
printf(msg);
fehler =1;
return;
};
flese_str(DATNAME, datei_lesen);
fclose(datei_lesen);
printf("Datei:<%s>\n",DATNAME);
// nur Stringattribute !!
UF_ATTR_ask_part_attrs_in_file (DATNAME, &n_attributes, &attributes );
printf("Anzahl der Attribute:<%d>\n",n_attributes);
// Gibt Anzahl zurück O.K.
if(n_attributes < 1) {
printf("##################################\n");
printf("##################################\n");
printf("--keine Atributte vorhanden! ------\n");
printf("##################################\n");
printf("##################################\n");
UF_free(attributes);
return;
};
for(i=1; i < n_attributes; i++) {
/* ******** hier liegt das Problem....*****************/
strcpy(attr_title ,(*attributes)[i].title );
strcpy(attribute_wert ,attributes[i]->string_value);
printf("Check -> Attributtitel: %s ; Attributwert: %s\n",attr_title, attribute_wert);
ATTR_check_Name( attr_title, attribute_wert );
};
printf("############# fertig ##############\n");
UF_free(attributes);
zv_save_Kopfdaten(dat_in);
return;
Ende
###############################.. UGII _ Struktur definition (Auszug)
typedef struct UF_ATTR_value_s UF_ATTR_value_t, *UF_ATTR_value_p_t;
/*****************************************************************************
* Structure used to return part attribute values.
*
****************************************************************************/
struct UF_ATTR_part_attr_s
{
char title[UF_ATTR_MAX_TITLE_LEN+1];
/* <len:UF_ATTR_MAX_TITLE_LEN+1>The title of the attribute */
UF_ATTR_value_t value;
/* The value for the part attribute */
char string_value[UF_ATTR_MAX_STRING_LEN+1];
/*<len:UF_ATTR_MAX_STRING_LEN+1> Buffer for the part
attribute string value.
The character pointer .value.value.string
will point to this buffer. */
};
typedef struct UF_ATTR_part_attr_s UF_ATTR_part_attr_t, *UF_ATTR_part_attr_p_t;
#################################
!!!!!!!!!!
Kann mir jemand einen Tipp geben, wie ich an die Stukturdaten komme...
UF_ATTR_part_attr_p_t *attributes;
------------------
Alfred Steller
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP