/* One way to get information into this function is * to pass in lists of info, each list corresponding * to a table or cell, and function to write that * table or cell. */ int writeHTMLLogFile(Geometrydata * gd, Analysisdata * ad, Datalog * dlog, FILE * htmlfile) { writeHTMLHeader(htmlfile); /* Write the data */ writeHTMLBody(dlog, ad, htmlfile); writeHTMLFooter(htmlfile); //fclose(htmlfile); /* Now write out a gnuplot file. */ writeGnuplotFile(gd); return 0; } /* close writeLogHTML() */
int main(void) { FILE* ofp = NULL; printf("We are about to create a file called %s for writing into it\n", FILENAME); ofp = fopen(FILENAME, "w"); if (ofp == NULL) { printf("Cannot open output file %s\n", FILENAME); exit(EXIT_FAILURE); // exit() is defined in <stdlib.h> } /* if */ printf("We created the file %s successfully for writing\n", FILENAME); writeHTMLHeader(ofp); Frame(ofp, 700, 400, 0, 0, 700, 350, 4, 0, 50, 250, 0.8); Circle(ofp, 250, 100, 99, 0, 50, 50, 0.2); Rectangle(ofp, 300, 50, 400, 100, 0, 150, 225, 0.5); Ellipse(ofp, 300, 300, 200, 50, 250, 0, 0, 0.4); Square(ofp, 50, 50, 200, 200, 250, 0, 250, 0.6); writeHTMLTail(ofp); printf("We wrote HTML5 code into the file %s successfully\n", FILENAME); fclose(ofp); printf("We closed the file %s successfully\n", FILENAME); return EXIT_SUCCESS; } /*main*/