Simplified Chinese | English
Convert C/C++ code into flowcharts
For more renderings, please refer to GALLERY
Two styles:
Polyline | smooth |
inline int read () { //快读
char c = getchar ();
int x = 0 , f = 1 ;
while (c < ' 0 ' || c > ' 9 ' ) {
if (c == ' - ' ) f = - 1 ;
c = getchar ();
}
while (c >= ' 0 ' && c <= ' 9 ' ) {
x = x * 10 + c - ' 0 ' ;
c = getchar ();
}
return x * f;
}
cargo install cxx2flow
It is recommended to download the binary file of the corresponding platform from Github Release on the right.
You can also go to GitHub Actions or Nightly.link to download the latest built binaries, including Linux, Windows and MacOS versions.
For users who have no command line experience, it is recommended to download and use the GUI version written based on tauri. https://github.com/Enter-tainer/cxx2flow-gui/releases
In order to compile the generated dot files, you need to install graphviz and add it to your PATH. You can also copy the generated results into the online graphviz service, such as http://magjac.com/graphviz-visual-editor/.
Convert your C/C++ code to control flow chart
Usage: cxx2flow [OPTIONS] [INPUT] [FUNCTION]
Arguments:
[INPUT] Sets the path of the input file. e.g. test.cpp
If not specified, cxx2flow will read from stdin.
[FUNCTION] The function you want to convert. e.g. main [default: main]
Options:
-o, --output <OUTPUT> Sets the output file.
If not specified, result will be directed to stdout.
e.g. graph.dot
-c, --curly Sets the style of the flow chart.
If specified, output flow chart will have curly connection line.
--cpp Use C preprocessor.
-t, --tikz Use tikz backend.
-d, --dump-ast Dump AST(For debug purpose only).
-h, --help Print help information
-V, --version Print version information
Note that you need to manually compile the dot file using graphviz to get SVG or PNG files.
EXAMPLES:
cat main.cpp | cxx2flow | dot -Tsvg -o test.svg
cxx2flow test.cpp | dot -Tpng -o test.png
cxx2flow main.cpp my_custom_func | dot -Tsvg -o test.svg
Please give me star if this application helps you!
如果这个应用有帮助到你,请给我点一个 star!
https://github.com/Enter-tainer/cxx2flow
cpp
, which is turned off by default and needs to be enabled manually using the --cpp
parameter. Will fail if cpp
does not exist in PATH
.