由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 怎样读一个不断更新的文件
相关主题
linux怎么读入一个超过有超过1B integer的binary file? (转载)两个process重复了,哪里错了
ask a question about struct in C programmingPython有什么好的方法建two-way pipe?
linux下面的程序间通信怎么样最快?程序占用很大内存
c++产生随机数发现自己写buffer还是能加速fwrite的
请教Matlab和IDL的处理数据能力差异help with PHP programming!!! (转载)
[合集] visual c++中读二进制图形文件的奇怪问题how to share I/O space among multiple processes??
请教一个文件IO的问题新手请问用mmap() copy file
serialization 到底该怎么理解啊?fread/fwrite有big/small endian问题吗?
相关话题的讨论汇总
话题: file话题: program话题: tail话题: read话题: pipe
进入Programming版参与讨论
1 (共1页)
p******g
发帖数: 347
1
I want to write a program to read a log file output from another program.
The file could be quite large. And I just want to read the last updated
content in it. How to achieve that? c++/python/shell/java... any kind of
language is fine.
I am think of tail -f, but how to read the pipe of "tail -f log | " in a program?
p******g
发帖数: 347
2
ok basically i am trying to do IPC. one way is to use named pipe. first use
makefifo to create a pipe, tail -f to the pipe, and read the pipe in my
program...

program?

【在 p******g 的大作中提到】
: I want to write a program to read a log file output from another program.
: The file could be quite large. And I just want to read the last updated
: content in it. How to achieve that? c++/python/shell/java... any kind of
: language is fine.
: I am think of tail -f, but how to read the pipe of "tail -f log | " in a program?

n******t
发帖数: 4406
3
popen

program?

【在 p******g 的大作中提到】
: I want to write a program to read a log file output from another program.
: The file could be quite large. And I just want to read the last updated
: content in it. How to achieve that? c++/python/shell/java... any kind of
: language is fine.
: I am think of tail -f, but how to read the pipe of "tail -f log | " in a program?

p******g
发帖数: 347
4
thx.
i came across this
for perl, there's a File:Tail extension: see the link
http://www.softwareplug.com/Linux/man/File::Tail
for python, see
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/436477

【在 n******t 的大作中提到】
: popen
:
: program?

f**y
发帖数: 138
5
while not just C functions fopen, ftell, fseek, fread, and fclose?
T*****9
发帖数: 2484
6
用一个while读,然后用一个足够长的buffer hold你读出来的东西,每读一次更新
什么语言都可以,推荐用python,或者perl更快

program?

【在 p******g 的大作中提到】
: I want to write a program to read a log file output from another program.
: The file could be quite large. And I just want to read the last updated
: content in it. How to achieve that? c++/python/shell/java... any kind of
: language is fine.
: I am think of tail -f, but how to read the pipe of "tail -f log | " in a program?

n**a
发帖数: 104
7
If the log file is on the SAME machine,and the operating system is Windows,
the most efficient way is to use Memory Mapped File, i.e., map the data file
into the address space of you process.
T*****9
发帖数: 2484
8
in linux, it is mmap, hehe

,
file

【在 n**a 的大作中提到】
: If the log file is on the SAME machine,and the operating system is Windows,
: the most efficient way is to use Memory Mapped File, i.e., map the data file
: into the address space of you process.

1 (共1页)
进入Programming版参与讨论
相关主题
fread/fwrite有big/small endian问题吗?请教Matlab和IDL的处理数据能力差异
请问如何恢复正常的IO?[合集] visual c++中读二进制图形文件的奇怪问题
New C++ programmer, need to ask a I/O file read question请教一个文件IO的问题
请推荐一本Socket Programming 的书吧serialization 到底该怎么理解啊?
linux怎么读入一个超过有超过1B integer的binary file? (转载)两个process重复了,哪里错了
ask a question about struct in C programmingPython有什么好的方法建two-way pipe?
linux下面的程序间通信怎么样最快?程序占用很大内存
c++产生随机数发现自己写buffer还是能加速fwrite的
相关话题的讨论汇总
话题: file话题: program话题: tail话题: read话题: pipe