Boost logo

Boost Users :

From: Micha³ Nowotka (mmmnow_at_[hidden])
Date: 2007-12-09 15:53:03


That solved my problem. Thank you very much.

BTW - if you used write_graphviz perhabs you could use gvRenderData or
gvRender too. I'm trying to display rendered graph image but without
storing it in temoprary file. So i found gvRenderData from graphviz
library most suitable to do that. But when i call this function it
simply seems not to be working.

when I type something like that:

  write_graphviz(my_stringstream, graf->Get_g());
  g = agmemread(const_cast<char*>(my_stringstream.str().c_str()));
  gvLayout(gvc, g, "dot");
  gvRenderFilename (gvc, g, "png","out.png");

I get valid png file and everything is OK.

But if i do this:

 write_graphviz(my_stringstream, graf->Get_g());
 g = agmemread(const_cast<char*>(my_stringstream.str().c_str()));
 gvLayout(gvc, g, "dot");

 char* data;
 int result = gvRenderData(gvc, g, "png", &data); // result = 0 so
that should be OK
 std::ofstream my_fstream("picture.png" , std::fstream::binary);
 while(*data!=EOF)
     my_fstream.put(*(data++));
 stru.close();

than an output file - picture.png is not valid and have smaller size
than out.png in first example.

I tried to change the following line:

 while(*data!=EOF)

to:

 while(*data!='\0')

but it still is not correct.

Maybe you've got some example of using vgRenderData - i would be gratefull.
If not - that's not a big deal - you've already helped me so much.

Cheers,

Micha³ Nowotka


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net