When I run a C++ program that creates an output file and writes something, the output file is not created, although the program works fine when I simply double click it from Windows Explorer.
This is the C# code I use to run the program:
try
{
Process p = StartProcess(ExecutableFileName);
p.Start();
p.WaitForExit();
Log("Program finished in " + ((p.ExitTime - p.StartTime).Milliseconds / 1000m) + " seconds with code " + p.ExitCode + "\n");
}
catch
{
Log("The program couldn't be started.");
}
UPDATE
I just found out why it's happening.
Apparently, when I launch it with C#, the C++ program doesn't see the input file in the relative directory, but when I explicitly specify it
ifstream in("C:\\Alex\\primes.in");
it gets it and everything works! Now I need to make it work with relative file paths...