Answer the question
In order to leave comments, you need to log in
Is it possible to force a change to a running object in the filesystem?
The question is, is it possible with a simple method to change the file of a running process from within the process itself?
When using ofstream, I get this output.
Got an error opening self: `Text file busy`
int fd;
fd = open (GlobalFilesystemPathToRunningObject.c_str(), O_RDONLY);
std::cout << fd << std::endl;
std::cout << flock(fd, LOCK_UN) << std::endl;
std::cout << open (GlobalFilesystemPathToRunningObject.c_str(), O_RDWR) << std::endl;
std::ofstream file(GlobalFilesystemPathToRunningObject.c_str(), std::ios_base::app);
if (file.fail())
std::cout << "Got an error openning self: `" << std::strerror(errno) << "`" << std::endl;
{
file << data.c_str();
file.close();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question