Hi,
I'm trying to write to a text file with following code:
std::ofstream out("/usr/share/NovaxTSP/INITreport.txt" , std::ios_base:: in |
std::ios_base:: out | std::ios_base:: app);
if(!out) { // if out couldn't be opened, print error and exit
std::cout << "Cannot open reportfile:
\"/usr/share/NovaxTSP/INITreport.txt\ "." << std::endl;
exit(0);
}
double num = 100.45;
char str[100];
strcpy(str, newLine.c_str() );
strcat(str,"\n\ r");
out.write((char *) &num, sizeof(double)) ;
out.write(str, strlen(str));
out.close();
the folder /usr/share/NovaxTSP/ has permissions set to 775 and the
application is run as root but i still always get: Cannot open
reportfile: "/usr/share/NovaxTSP/INITreport.txt" .
Why??? I don't understand, i made a df -h and there's enough space available
as well.
Does anyone have any other ideas on what to check?
I also touched the file before appending but that didn't change it either.
I appreciate every input!
Thank you to help me further!
Ron
I'm trying to write to a text file with following code:
std::ofstream out("/usr/share/NovaxTSP/INITreport.txt" , std::ios_base:: in |
std::ios_base:: out | std::ios_base:: app);
if(!out) { // if out couldn't be opened, print error and exit
std::cout << "Cannot open reportfile:
\"/usr/share/NovaxTSP/INITreport.txt\ "." << std::endl;
exit(0);
}
double num = 100.45;
char str[100];
strcpy(str, newLine.c_str() );
strcat(str,"\n\ r");
out.write((char *) &num, sizeof(double)) ;
out.write(str, strlen(str));
out.close();
the folder /usr/share/NovaxTSP/ has permissions set to 775 and the
application is run as root but i still always get: Cannot open
reportfile: "/usr/share/NovaxTSP/INITreport.txt" .
Why??? I don't understand, i made a df -h and there's enough space available
as well.
Does anyone have any other ideas on what to check?
I also touched the file before appending but that didn't change it either.
I appreciate every input!
Thank you to help me further!
Ron
Comment