Fork, pipe and file operations
I have got pipe ( http://linux.die.net/man/2/pipe ) to enable communication between 2 processes in forked program. Everything goes right until I want to perform some file operations.
This code works: Code:
pipe.writeBuffer(message.c_str(), message.length()); Code:
ofstream file; What is wrong with that? Is it a problem with file descriptor? Pipe uses fd[0] - input and fd[1] - output. |
You could try functions fopen+fwrite+fread+fclose, with checking/logging the return values after every function-call.
|
If, for example, file was not successfully opened, it is entirely possible that the subsequent attempt to write to it silently failed . . .
|
NevemTeve,
I prefer to use fstream. sundialsvcs, file was opened correctly, at least is_open() call gives true result. |
This is the example which shows the problem:
http://pastebin.com/gJ4PbHvy |
All times are GMT -5. The time now is 03:58 PM. |