Sample Program : Program Description : Writing the Textual Information

Writing the Textual Information
void activity_text_output(ac_text)

This function defines how textual information retrieved from the database is output. In this example, this information is written into the report. It can also be manipulated by your own report generator, if desired.

stm_ac_text_ptr ac_text;

 

Declares the pointer to the activity’s textual record.

printf("\n\n\n\n\n activity textual information\n");
printf("============================\n");

 

These statements generate a title for the output; they precede the retrieved information for each activity.

printf("\n activity name: %s", ac_text->ac_name);
printf("\n activity in chart: %d", ac_text->ac_chart);
printf("\n activity unique name: %s",
ac_text->ac_uniquename);
printf("\n activity synonym: %s", ac_text->ac_synonym);
printf("\n activity type:%s",
activity_type(ac_text->ac_type));
printf("\n activity termination: %s",
activity_termination_type (
ac_text->ac_termination));
printf("\n activity short description: %s",
ac_text->ac_short_des);
printf("\n activity long description:\n\n");

 

Prints the information retrieved from the activity’s fields.

if ((fd = fopen (ac_text->ac_long_des, "r")) == NIL)
printf("\n\n cannot open file for printing");
while (fgets(array,81,fd) != NIL) printf("%s", array);

 

These statements loop through the element’s long description, printing the lines one by one until a null string is reached.