Anyone out there kind enough to write me this c code, I'd greatly appreciate it because I'm not much of a c programmer. Or any advise that might help is ok too. Basically I want to write the contents of a moving/open file at the time of the read to another file, and then removing that part of file from the source. The file descriptor should be preserve so the application will keep on writing to the source file.
In a nutshell, I need:
$ mv source_file dest_file; cat /dev/null>source_file
the problem with this is the application will still write to dest_file because I think its going by file descriptor, not filename.
This command on the otherhand looses some data since its a constantly moving file:
$ cp source_file dest_file; cat /dev/null>source_file
Thanks in advance.
In a nutshell, I need:
$ mv source_file dest_file; cat /dev/null>source_file
the problem with this is the application will still write to dest_file because I think its going by file descriptor, not filename.
This command on the otherhand looses some data since its a constantly moving file:
$ cp source_file dest_file; cat /dev/null>source_file
Thanks in advance.