textfile - 写入文件的开头? [英] textfile - write to beginning of file?

查看:67
本文介绍了textfile - 写入文件的开头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 - 来自相关asp新手的问题


我过去曾写过文本文件,但总是追加新数据

结尾文本文件。我现在想要将新数据添加到

文件的开头。


文本文件将是通过Web表单下达的订单记录。

文本文件只是订单的记录,但它需要在

降序日期顺序中 - 每个新记录都添加到开头。


提前感谢任何关于如何实现的建议。


John

解决方案



" btopenworld" < jo ** @ siteweave.netwrote in message

news:2b **************************** ** @ bt.com ...


嗨 - 来自相关asp新手的问题


我已写入文字过去的文件,但总是将新数据附加到文本文件末尾的
。我现在想要将新数据添加到





该文件。


文本文件将是通过网络表单下达的订单记录。

文本文件只是订单的记录,但它需要在

降序日期顺序中 - 每个新记录都添加到开头。


提前感谢任何关于如何实现这一目标的建议。


John



是有没有理由你没有使用数据库?


如果是这样,那么XML将是一个更好的解决方案。


一个文本文件是非常有限。


你好安东尼


我不会使用数据库,因为它没有'看起来不值得。这个文件唯一的原因是因为一个组织内的几个人可以放置

订单,每个人都需要检查一下其他人最近没有订购过这个订单。 />
公司的同一项目。


我认为写入XML文件会遇到同样的问题,因为它是

真的只是一个文本文件,但也许我正在接近这个错误。


非常感谢您的关注和帮助。


John


" Anthony Jones" < An*@yadayadayada.com写信息

新闻:Op ************** @ TK2MSFTNGP05.phx.gbl ...


>

" btopenworld" < jo ** @ siteweave.netwrote in message

news:2b **************************** ** @ bt.com ...


嗨 - 来自相关asp新手的问题


我已写入文字过去的文件,但总是附加新数据





文本文件的结尾。我现在想要将新数据添加到



开始


of


文件。


文本文件将是通过网络表单下达的订单记录。

文本文件只是订单的记录,但它需要在

降序日期顺序中 - 每个新记录都添加到开头。


提前感谢任何关于如何实现这一目标的建议。


John



是有没有理由你没有使用数据库?


如果是这样,那么XML将是一个更好的解决方案。


一个文本文件是非常有限。




" btopenworld" < jo ** @siteweave.netwrote:


>嗨 - 来自相关asp新手的问题

我写过文本文件在过去,但总是将新数据附加到文本文件的末尾。我现在想要将新数据添加到文件的开头。



无法完成。您将不得不创建一个新文件,将新内容写入其中,读取旧文件并将该数据放在新文件中。然后

删除旧文件,并重命名新文件。


-

Tim Slattery

MS MVP(DTS)
Sl********@bls.gov
http://members.cox.net/slatteryt


Hi - question from a relative asp novice

I have written to text files in the past, but always appending new data to
the end of the text file. I now want to add the new data to the beginning of
the file.

The text file would be a record of orders placed through a web form. The
text file would merely be a record of the orders but it needs to be in
descending date order - each new record added to the beginning.

Thanks in advance for any suggestions as to how this is achieved.

John

解决方案


"btopenworld" <jo**@siteweave.netwrote in message
news:2b******************************@bt.com...

Hi - question from a relative asp novice

I have written to text files in the past, but always appending new data to
the end of the text file. I now want to add the new data to the beginning

of

the file.

The text file would be a record of orders placed through a web form. The
text file would merely be a record of the orders but it needs to be in
descending date order - each new record added to the beginning.

Thanks in advance for any suggestions as to how this is achieved.

John

Is there a reason you are not using a DB for this?

If so then XML would be a better solution.

A text file is very limiting.


Hi Anthony

I wasn''t going to use a DB because it didn''t seem worth it. The only reason
for the file is because several people within an organisation can place
orders and each needs to check that some-one else hasn''t recently ordered
the same item for the firm.

I assumed that I would have the same problem writing to an XML file as it is
really only a text file but perhaps I am approaching this wrongly.

Thanks very much for your interest and help.

John


"Anthony Jones" <An*@yadayadayada.comwrote in message
news:Op**************@TK2MSFTNGP05.phx.gbl...

>
"btopenworld" <jo**@siteweave.netwrote in message
news:2b******************************@bt.com...

Hi - question from a relative asp novice

I have written to text files in the past, but always appending new data

to

the end of the text file. I now want to add the new data to the

beginning

of

the file.

The text file would be a record of orders placed through a web form. The
text file would merely be a record of the orders but it needs to be in
descending date order - each new record added to the beginning.

Thanks in advance for any suggestions as to how this is achieved.

John


Is there a reason you are not using a DB for this?

If so then XML would be a better solution.

A text file is very limiting.




"btopenworld" <jo**@siteweave.netwrote:

>Hi - question from a relative asp novice

I have written to text files in the past, but always appending new data to
the end of the text file. I now want to add the new data to the beginning of
the file.

Can''t be done. You''ll have to create a new file, write the new stuff
to it, read the old file and put that data on the new file. Then
delete the old file, and rename the new one.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
http://members.cox.net/slatteryt


这篇关于textfile - 写入文件的开头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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