Re: debugging problem
Ron Eggler wrote:
Hi,
I'm developing software for Linux on my desktop. The software gets compiled
and the binary is downloaded to the target system where i can't install a
debugging system or something.
I've written following code:
#ifdef INIT_REPORT
std::ofstream out("/usr/share/NovaxTSP/INITreport.txt", std::ios_base::in |
std::ios_base::out | std::ios_base::app);
Is this combination of flags legit?
if(!out) { // if out couldn't be opened, print error and exit
std::cout << "Cannot open reportfile:
\"/usr/share/NovaxTSP/INITreport.txt\"." << std::endl;
Odds are good that errno is probably valid here, assuming you're using
gcc. Try adding:
#include <cerrno>
#include <cstdio>
at the top, and adding
std::cout << std::strerror(errno)
in your error message.
exit(0);
}
std::string str = newLine + "\n";
out << newLine.c_str() << std::endl;
out.close();
#endif
The problem is, it works just fine on my desktop but it returns
with "/usr/share/NovaxTSP/INITreport.txt" on the target system. I'm root
and i do have write access to /usr/share/NovaxTSP/. I have
tried "touch /usr/share/NovaxTSP/INITreport.txt" but this didn't help
either.
df -h shows that I'm not running out of space either
Does any one have any other idea what could go wrong?
Thanks,
Ron