00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <openrj/openrj.h>
00026
00027
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <string.h>
00031
00032
00033
00034 int main()
00035 {
00036 unsigned flags = 0;
00037 ORJDatabase const *db;
00038 ORJError error;
00039 ORJRC rc;
00040
00041
00042 rc = ORJ_ReadDatabase("|i|n|v|a|l|i|d|n|a|m|e|", NULL, flags, &db, &error);
00043
00044 if(0 != rc)
00045 {
00046 char message[1001];
00047
00048 fprintf(stdout, "Display the error manually:\n");
00049 fprintf(stderr, " Error at line %ld, column %ld: %s\n", (long)error.invalidLine, (long)error.invalidColumn, ORJ_GetErrorStringA(rc));
00050
00051 fprintf(stdout, "Display the error using ORJ_FormatErrorA():\n");
00052 ORJ_FormatErrorA(&message[0], sizeof(message) / sizeof(0[message]), rc, &error, " Error code %d means: %E\n", (int)rc);
00053 fprintf(stderr, message);
00054
00055 return EXIT_FAILURE;
00056 }
00057 else
00058 {
00059
00060 ORJ_FreeDatabase(db);
00061 }
00062
00063 return EXIT_SUCCESS;
00064 }
00065
00066
00067
00068