Required to convert .txt file to .gv file using C program

Greetings,
I need to convert a .txt file to a .gv file using C program. That is i need to write a file converter for that purpose. The text file has the nodes and directed/undirected edges written exactly the same way in which it is written in a .gv file. However, the file needs to be a .gv file. Kindly help with the C converter.

Thanks!!

You don't need a C program.

You don't need a C program. Just do a copy:

    cp mygraph.txt mygraph.gv

A .gv file is just a text file whose content contains valid graph descriptions using the DOT language.

drawing the graph in graphviz from .exe output of a c program

Hi,

The cp command is only changing the extension of the file.

Can the .exe file generated by the C program be run by graphviz? This .exe file displays the names of the edges written in the same way in which we write it in the graphviz editor to draw the graph-- i.e nodes with arrows and all..

can this .exe file be accepted by graphviz to run and display the visualized result?

If yes, how?

 

Thanks a lot!!!

 

I am not understanding what

I am not understanding what you're trying to do or what types of files you are working with. Where does this .exe file come from? By compiling a C program? If you run the .exe file, what does it do? You said you were starting with a .txt file. What does this contain? Can you give an example?

The only files accepted by Graphviz are text files containing the descriptions of graph given in the DOT language. You can either run a program to produce a DOT file and use that as input to Graphviz, or you can write a C program that can use Graphviz as a library.

Recent comments