PDA

View Full Version : fprintf and QProcess problem



darrenbkl
30th May 2010, 08:04
Hi I'm quite new to QT programming so I'm puzzled over a few things while coding. I'm currently using Fedora 10.

1. How do I fprintf output to a file in the other folder? I know how save to a file in the same dir as the program. It seems like fopen doesn't accept a path to the other folder?

2. I have a script in c++, which was coded using codeblock and the .exe is located inside bin/debug, different folder with my Qt gui interface. In the Qt gui interface, after a trigger on the pushbutton, I want to run the script in terminal, and output to the display in the Qt gui interface. but after
QProcess* proc = new QProcess;
proc->start("/home/username/Desktop/testfile/bin/Debug/testfile");
I can't seems to run it,
So I tried the script by execute ./testfile in terminal, it did run. What could be the problem?

SixDegrees
30th May 2010, 17:08
fopen() takes a complete path. If it fails to open the file specified, it may be that the path is wrong, or that permissions are wrong. If fopen() returns a NULL pointer, immediately check errno for more information on the cause of the failure.See also perror().