编辑文本文件? [英] Edit text file?
问题描述
我有一个存储用户输入的文本文件。稍后如果用户从输入表单编辑输入
数据。如何更新输入文本文件?如果经常更新
文本文件,会不会引起问题?
提前感谢您的帮助。
I have a text file which stores user input. Later if user edited the input
data from a input form. How can I update the input text file? If update the
text file too often, would it cause problem?
Thanks in advance for any help.
推荐答案
" Nina" <镍** @ discussions.microsoft.com> schrieb:
"Nina" <Ni**@discussions.microsoft.com> schrieb:
我有一个存储用户输入的文本文件。稍后如果用户从输入表单编辑了
输入数据。如何更新输入文本文件?
对于小文本文件,最简单的解决方案是重写整个文件。
这并不意味着删除文件然后创建一个新文件,但是它
表示使用''FileStream.SetLength'将文件的长度设置为0然后
使用''System将数据写入文件。 IO.StreamWriter''。
如果经常更新文本文件,会不会引起问题?
I have a text file which stores user input. Later if user edited the
input
data from a input form. How can I update the input text file?
For small text files, the simplest solution is to rewrite the whole file.
This doesn''t mean deleting the file and then creating a new one, but it
means setting the file''s length to 0 using ''FileStream.SetLength'' and then
write the data to the file using ''System.IO.StreamWriter''.
If update the text file too often, would it cause problem?
这取决于文件的大小文件和更新之间的间隔。
-
MS Herfried K. Wagner
MVP< URL:http: //dotnet.mvps.org/>
VB< URL:http://dotnet.mvps.org/dotnet/faqs/>
This depends on the size of the file and the intervalls between the updates.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>
非常感谢你的帮助。 5到10页的文本文件将被视为小文本文件吗?
Nina
Herfried K. Wagner [MVP]"写道:
Thank you so much for your help. Will 5 to 10 pages''s text file be
considered as a small text file?
Nina
"Herfried K. Wagner [MVP]" wrote:
" Nina" <镍** @ discussions.microsoft.com> schrieb:
"Nina" <Ni**@discussions.microsoft.com> schrieb:
我有一个存储用户输入的文本文件。稍后如果用户从输入表单编辑了
输入数据。如何更新输入文本文件?
I have a text file which stores user input. Later if user edited the
input
data from a input form. How can I update the input text file?
对于小文本文件,最简单的解决方案是重写整个文件。
这并不意味着删除文件和然后创建一个新的,但它意味着使用''FileStream.SetLength''将文件的长度设置为0然后
使用''System.IO.StreamWriter将数据写入文件''。
For small text files, the simplest solution is to rewrite the whole file.
This doesn''t mean deleting the file and then creating a new one, but it
means setting the file''s length to 0 using ''FileStream.SetLength'' and then
write the data to the file using ''System.IO.StreamWriter''.
如果过于频繁地更新文本文件,是否会导致问题?
If update the text file too often, would it cause problem?
这取决于文件的大小和更新之间的间隔。
- MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB < URL:http://dotnet.mvps.org/dotnet/faqs/>
This depends on the size of the file and the intervalls between the updates.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
" Nina" <镍** @ discussions.microsoft.com> schrieb:
"Nina" <Ni**@discussions.microsoft.com> schrieb:
将5到10页的文本文件视为小文本文件吗?
Will 5 to 10 pages''s text file be
considered as a small text file?
我认为一切< 10 KB一个小文件,但那只是我个人的
意见。
-
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http://dotnet.mvps。 org / dotnet / faqs />
I consider everything < 10 KB a "small file", but that''s only my personal
opinion.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
这篇关于编辑文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!