/* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: testread.cpt */ /** @file testread.cpp The testread module. */ #line 1 "testread.cpt" #include #include "WxdkdrawObj.h" #include "WxdkdrawRead.h" static int exval = EXIT_FAILURE; /* Test program to read a drawing. Specify drawing file name as first argument. */ int main(int argc, char *argv[]) { wxdrd_status_t status; Wxd_drawing_t *pdrw; FILE *fipo; if (1 < argc) { fipo = fopen(argv[1], "r"); if (NULL != fipo) { wxdrd_status_init(&status); pdrw = wxdrd_read_file(fipo, &status); if (NULL != pdrw) { fputs("Successfully read file \"", stdout); fputs(argv[1], stdout); fputs("\".\n", stdout); exval = EXIT_SUCCESS; wxdobj_drw_delete(pdrw); } else { fputs("ERROR: Failed to read drawing!\n", stderr); fprintf(stderr, "Line number: %lu\n", status.ln); fprintf( stderr, "Text word: %lu\n", (unsigned long)(status.te) ); fprintf(stderr, "Error code: %d\n", status.ec); } fclose(fipo); } else { fputs("ERROR: Failed to open file \"", stderr); fputs(argv[1], stderr); fputs("\"!\n", stderr); } } else { fputs("ERROR: Missing file name\n", stderr); } return exval; } /* vim: set ai sw=4 ts=4 : */