C ++ .net,读取打开的文件。 [英] C++ .net, reading an opened file.

查看:75
本文介绍了C ++ .net,读取打开的文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想做命令tail -f在unix上。

我想读取一个LOG文件并将所有新条目记录到该文件中。


有人有任何想法吗?


谢谢

Patrick

Hi,

I want to do like the command "tail -f" on unix.
I want to read a LOG file and catch all new entries into that file.

Someone have any idea?

Thanks
Patrick

推荐答案

< pb ***** @ hotmail.com>写了...
<pb*****@hotmail.com> wrote...
我想做命令tail -f在unix上。
我想阅读一个LOG文件并将所有新条目记录到该文件中。

有人有任何想法吗?
I want to do like the command "tail -f" on unix.
I want to read a LOG file and catch all new entries into that file.

Someone have any idea?




有几种方法可以用C ++读取文件。你试过

吗?你有''FILE *''和相应的''fread''或''fgets'',

你有'std :: ifstream''和相应的''read''或者''getline''。

你读的C ++书是什么,不解释文件I / O?


V



There are several ways to read files in C++. Have you tried any of
them? You have ''FILE*'' and the corresponding ''fread'' or ''fgets'',
you have ''std::ifstream'' and the corresponding ''read'' or ''getline''.

What C++ book are you reading that doesn''t explain file I/O?

V


在消息< tf ******************** @ comcast.com> ;, Victor Bazarov

< v。******** @ comAcast.net>写道
In message <tf********************@comcast.com>, Victor Bazarov
<v.********@comAcast.net> writes
< pb ***** @ hotmail.com>写了...
<pb*****@hotmail.com> wrote...
我想做命令tail -f在unix上。
我想阅读一个LOG文件,并将所有新条目记录到该文件中。

有人有任何想法吗?
I want to do like the command "tail -f" on unix.
I want to read a LOG file and catch all new entries into that file.

Someone have any idea?



有几种用C ++读取文件的方法。你有没有试过它们?你有''FILE *''和相应的''fread''或''fgets'',
你有'std :: ifstream''和相应的''read''或''getline' '。

您正在阅读哪些C ++书籍并不能解释文件I / O?



There are several ways to read files in C++. Have you tried any of
them? You have ''FILE*'' and the corresponding ''fread'' or ''fgets'',
you have ''std::ifstream'' and the corresponding ''read'' or ''getline''.

What C++ book are you reading that doesn''t explain file I/O?




我没见过很多C ++书籍解释了如何等待文件被另一个应用程序更改为
,然后输出更改,这实际上就是'尾巴'所做的那样。

。 />

对OP的简短回答:你不能用标准的C ++来做。

-

Richard Herring


" Richard Herring" <菊** @ [127.0.0.1] GT;写了...
"Richard Herring" <ju**@[127.0.0.1]> wrote...
在消息< tf ******************** @ comcast.com> ;, Victor Patzarov
< ;五******** @ comAcast.net>写道
In message <tf********************@comcast.com>, Victor Bazarov
<v.********@comAcast.net> writes
< pb ***** @ hotmail.com>写了...
<pb*****@hotmail.com> wrote...
我想做命令tail -f在unix上。
我想阅读一个LOG文件,并将所有新条目记录到该文件中。

有人有任何想法吗?
I want to do like the command "tail -f" on unix.
I want to read a LOG file and catch all new entries into that file.

Someone have any idea?



有几种用C ++读取文件的方法。你有没有试过它们?你有''FILE *''和相应的''fread''或''fgets'',
你有'std :: ifstream''和相应的''read''或''getline' '。

您正在阅读哪些C ++书籍并不能解释文件I / O?



There are several ways to read files in C++. Have you tried any of
them? You have ''FILE*'' and the corresponding ''fread'' or ''fgets'',
you have ''std::ifstream'' and the corresponding ''read'' or ''getline''.

What C++ book are you reading that doesn''t explain file I/O?



我没有遇到很多可以解释的C ++书籍如何等待文件被另一个应用程序更改,然后输出更改,这实际上是尾巴的作用。

对OP的简短回答:你不能用标准的C ++来做。



I haven''t met many C++ books that explain how to wait until a file is
changed by another application, then output the changes, which is
effectively what ''tail'' does.

Short answer to the OP: you can''t do it with standard C++.




谁说必须等到文件被另一个文件改变了

申请?为什么不定期这样做呢? *这可以用标准C ++完成

,不是吗?


V



Who says that one has to wait until "a file is changed by another
application"? Why not just do it periodically? *THAT* can be done
with standard C++, can''t it?

V


这篇关于C ++ .net,读取打开的文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆