source: branches/uq/examples/c-example/compress.c @ 5679

Last change on this file since 5679 was 5679, checked in by ldelgass, 9 years ago

Full merge 1.3 branch to uq branch to sync. Fixed partial subdirectory merge
by removing mergeinfo from lang/python/Rappture directory.

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