source: trunk/examples/c-example/compress.c @ 1464

Last change on this file since 1464 was 872, checked in by dkearney, 16 years ago

mainly code cleanups that i've made and stored in my repository over time.

File size: 1.5 KB
Line 
1// ======================================================================
2//  Copyright (c) 2004-2007  Purdue Research Foundation
3//  See the file "license.terms" for information on usage and
4//  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5// ======================================================================
6
7#include "rappture.h"
8
9#include <stdio.h>
10
11int main(int argc, char * argv[])
12{
13
14    RpLibrary* lib = NULL;
15    RapptureBuffer buf;
16
17    const char* xmlFilePath = NULL;
18    const char* dxFilePath = NULL;
19
20    if (argc < 3) {
21        printf("usage: %s driver.xml picture.dx\n", argv[0]);
22    }
23
24    xmlFilePath = argv[1];
25    dxFilePath = argv[2];
26
27    // create a rappture library from the file filePath
28    lib = rpLibrary(xmlFilePath);
29
30    if (lib == NULL) {
31        // cannot open file or out of memory
32        printf("FAILED creating Rappture Library\n");
33        return 1;
34    }
35
36    // label the graph with a title
37    rpPutString(lib,"output.field(dxFile1).about.label",
38        "Example loading of a DX file",RPLIB_OVERWRITE);
39    rpPutFile(lib,"output.field(dxFile1).component.dx",
40        dxFilePath,RPLIB_COMPRESS,RPLIB_OVERWRITE);
41
42    RapptureBufferInit(&buf);
43    rpGetData(lib,"output.field(dxFile1).component.dx",&buf);
44    RapptureBufferDecode(&buf,1,1);
45    RapptureBufferDump(&buf,"bufferDump.txt");
46    RapptureBufferFree(&buf);
47
48    // write output to run file and signal
49    rpResult(lib);
50
51    rpFreeLibrary(&lib);
52
53    return 0;
54}
Note: See TracBrowser for help on using the repository browser.