Dot.exe error codes

I am calling dot.exe using the windows “C” function system.
system(“dot.exe -Tjpg -oFile.jpg”);
The system is returning an error code of 1, which I assume is a pass through of dot.exe error code
If I call the exact same directly in a command window it works and produces the .jpg file.
What does dot.exe error code of 1 mean? Is there a memory size issue calling within system() function within “C” code? If so is there anything to do? This same C code has worked on previous computers. Thank You, Jim

Can you share your input file?
Also, what version of Graphviz (dot -V) and what OS?
Finally, was “File.jpg” usable?

dot - graphviz version 2.38.0 (201404413.2041)
Windows 10 Pro - Version 21H2 OS Build 19044.2604
When running under the windows command prompt the file.jpg produced was fine.
When running from within C code: system(“dot.exe -Tjpg -oFile.jpg”); returns 1 and does not produce a .jpg file
My understanding is that system() returns a -1 if it cannot execute the command, otherwise returns the exit code of the command being run.
My is:
digraph g {
graph [
rankdir = “LR”
node [
fontsize = “16”
shape = “record”
edge [
node23D18B983D0 [
shape = “circle”
label = “E”
node23D18B98428 [
shape = “circle”
label = “R”
node23D18B98480 [
shape = “circle”
label = “R^2”
node23D18B984D8 [
shape = “circle”
label = “R^3”
node23D18B98530 [
shape = “circle”
label = “F”
node23D18B98588 [
shape = “circle”
label = “FR”
node23D18B985E0 [
shape = “circle”
label = “R^2F”
node23D18B98638 [
shape = “circle”
label = “RF”
node23D18B983D0 → node23D18B98428 [ label = “R” ];
node23D18B983D0 → node23D18B98530 [ label = “F” ];
node23D18B98428 → node23D18B98480 [ label = “R” ];
node23D18B98428 → node23D18B98588 [ label = “F” ];
node23D18B98480 → node23D18B984D8 [ label = “R” ];
node23D18B98480 → node23D18B985E0 [ label = “F” ];
node23D18B984D8 → node23D18B983D0 [ label = “R” ];
node23D18B984D8 → node23D18B98638 [ label = “F” ];
node23D18B98530 → node23D18B98638 [ label = “R” ];
node23D18B98530 → node23D18B983D0 [ label = “F” ];
node23D18B98588 → node23D18B98530 [ label = “R” ];
node23D18B98588 → node23D18B98428 [ label = “F” ];
node23D18B985E0 → node23D18B98588 [ label = “R” ];
node23D18B985E0 → node23D18B98480 [ label = “F” ];
node23D18B98638 → node23D18B985E0 [ label = “R” ];
node23D18B98638 → node23D18B984D8 [ label = “F” ];

[next time you include code, please “upload” it, your copy/paste included non-ASCII characters - the double quotes & the arrows - that give dot grief]
Your version of dot is 9 years old (the 2014 in 201404413.2041). I suggest downloading a new & improved version from Download | Graphviz
There is a good chance that will solve the problem. If not, come on back.

Hi Steve,
FYI, the newest version of Graphviz did not help. I did track down the issue however. I was running my code within Visual Studio which apparently keeps its own path variable. So while I had set the path variable in windows to find dot.exe the code running under visual studio was not finding dot.exe. Once I added to the path under the properties of the project I was running, it worked fine!
Thanks for your time and at least I am now running the new & improved version! Jim

So, not actually a graphviz error?

There was a legitimate error on my part. The problem was there was an error code == 1 returned by the system call, but I could not find out what that meant. The windows error for code == 1 is “Operation not permitted” which made no sense to me. I also could not find any documentation on graphviz site that described any error code that dot.exe might error out with. So it consequently took more time and experimentation to track the real problem down. If dot.exe exits out because it cannot find the input file, or the input file is corrupt does it exit out with any error codes? What are they? Are they documented? My problem with seeing any printed error message to “stdout” from dot.exe was that the system call opened a Windows command window internally, failed out of dot.exe and closed the window too fast to see any text that dot.exe might have displayed. All I got was the lonely error code of ‘1’. Hope that was helpful.

Graphviz is indeed pretty vague with its error codes (usually 1 or EXIT_FAILURE). We should probably use something like the sysexits.h error codes on everything except Windows and the WinError.h error codes on Windows.

Having said that, nothing Graphviz can do will give you a readable error in this scenario. A command line application like dot has only stdout, stderr, and its exit status with which to report errors.