On Thu, Nov 13, 2003 at 10:42:37AM +0100, Pitisi wrote:
Hi Didier.
> Did somebody ever used the function rrd_graph in a C program?
Not yet.

> If  yes, can you describe the meaning of the different parameters
> (rrdtool 1.0.41):
> int    rrd_graph(int, char **, char ***, int *, int *);
Sure:

There meanning is the following:

int - Argument counter (argc)
char** - Array of arguments (argv[])
char *** - Pointer to the array, holding the picture
int * - Pointer which stores the width of the picture
int * - Pointer which stores the height of the picture

One note about the char *** ...
You don't have to allocate memory for the picture data.
If you pass a NULL pointer instead, rrd_graph will
calloc() it for you. Usually you can't allocate the memory
before calling rrd_graph, because you don't know the
size of the picture.

e.g.:

[... snipp ...]
  int rrd_ret=0;
  int x=0;
  int y=0;
  int rrd_argv=0;
  char **rrdargv=NULL;
  char **mypic=NULL;

/*
 * define and fill int rrd_argc and rrd_argv ...
 * ... lines later
 */

  rrd_ret=rrd_graph(rrd_argc,rrd_argv,&mypic,&x,&y);

  if (rrd_ret==0)
  {
    printf("Got a picture: W=%d ; H=%d\n",x,y);
  }
[... snipp ...]

It's easy.

HTH ... Andreas.

P.S.: Don't forget to free() the memory allocated by rrd_graph :-)

-- 
Dipl.-Ing. Andreas Maus             science+computing ag
System Administration               Hagellocher Weg 71-75
mail: [EMAIL PROTECTED]   72070 Tuebingen, Germany
tel.: +49 7071 9457 456             www.science-computing.de

-- Binary/unsupported file stripped by Ecartis --
-- Err : No filename to use for decode, file stripped.
-- Type: application/pgp-signature


--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

Reply via email to