Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:09:19+00:00 2026-05-26T02:09:19+00:00

I currently use C++ to do some graph related computation using boost::graph. boost::graph can

  • 0

I currently use C++ to do some graph related computation using boost::graph.
boost::graph can output its graph as a dot file and I use a std::stringstream to capture the output dot file. Thus the contents of the dot file resides in memory.

I want to use the dot file to visualize the graph (as fast as possible). Thus I want to generate the dot file, generate an svg file and print it onto some canvas. I want to avoid using temporary files for this, as the graphs shall be small and memory is available anyway.

However graphviz libgraph has only the function extern Agraph_t *agread(FILE *); the only way I can imagine to make this working is to hack around in the filehandle struct __FILE which is really not portable.

How would you let a library read you memory contents as a file in Unix/linux?

I just found out that libcgraph from GraphViz allows to enter a overloaded version here, but so far the documentation doesn’t point me to some usefull place.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:09:20+00:00Added an answer on May 26, 2026 at 2:09 am

    Well, it is arguably a bug in the API, but here’s an idea. This is assuming that the agread() function would read the file in as binary data.

    Note that I am not familiar with the API you’re using, but I hope this may be useful anyway.

    1. Map a file into memory using mmap().
    2. Use that memory region to do your graph construction.
    3. When it comes time to call agread(), open that file descriptor into a FILE * struct (fopen() or fdopen() if you didn’t close the descriptor).
    4. Pass the FILE * struct.

    Edit: Or, ignore my answer and use the fmemopen() call. It probably is exactly what you need. I didn’t want to delete my answer though, in case someone is currently writing a response :-).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing some user controls so that I can use them at
I am currently doing some socket programming using C/C++. To be able to use
I currently use my local web server to allow costumers to preview some applications
I currently use Strawberry Perl as my primary Perl distribution. However, I have some
I'm currently building a project and I would like to make use of some
currently i'm trying to use imagick to generate some images without saving them on
I want to get into Erlang programming, specifically some yaws stuff. (Currently, I use
Short question is: how can i use graph api oauth redirects mechanism to authenticate
I'm currently using Matplotlib to create a histogram: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as
I currently use makedepend, but it I ran into some problems with it and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.