Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2004, 09:26 AM
Authorized User
 
Join Date: Apr 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sara_1981
Default Help me in writing to first line of existing file

hi there,
anybody here know how we could write to first line of existing file, my file is aspx format and it is full, everytime I write with streamwriter, it just write to last line of file but I need to write in to first line. could anyone help me please.
(asp.net)
regards
sara

Regards
Sara
__________________
Regards
Sara
 
Old September 6th, 2004, 06:09 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello Sara,
can you explain about your scenario more,
where do you want to save the file,in client or server
why a ASPX file?
because you want to write the line at the begining,you should do some steps!
1-make a new file
2-write your new lines to it
3-open your ASPX file
4-read from ASPX file and write them to new file while you havnt reached the end of ASPX file
5-delete ASPX file
6-rename the new file to exact name of your ASPX file.
if you have some problems in every step ask me I Will explain it in detail ...
HtH.

--------------------------------------------
Mehdi.:)
 
Old September 6th, 2004, 10:48 PM
Authorized User
 
Join Date: Apr 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sara_1981
Default

Hi,
thanks very much for your reply, yeah this way is possible but it is not good when we have more than 5000 files which every file is full of data, is there any other way that without needing to copying that file to another, just open current file and write in first line of it?
thanks in advance.


Regards
Sara
 
Old September 7th, 2004, 11:40 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,
for working only on one file the method I told you would be fast enough,but for working on 5000 files,you should consider other ways,I dont know them exactly(but I will thinking off them)
maybe we should use Asynchronous Delegates or Asynchronous Programming
could someone help us what we should do here?

--------------------------------------------
Mehdi.:)
 
Old September 19th, 2004, 08:59 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

I was looking for a solution could make this process faster,but I didnt find anything?
a simple way is,
Code:
for(int i=1;i<=5000;i++)
{
 string Filename="File"+i.ToString();  
 ChangeFile(FileName);//this method changes one file 
}
but this method works very slowly for 5000 files,
can anybody give me an idea about this problem?
Thanks in advance.

--------------------------------------------
Mehdi.:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
writing into a file in linux file system anboss XSLT 6 June 19th, 2008 01:56 PM
The problem during writing into an existing cookie vishnu108mishra ASP.NET 2.0 Professional 2 March 5th, 2008 02:45 AM
How to read file line by line in EVC++ iriskab Visual C++ 0 September 27th, 2006 01:39 PM
creating new xml file from existing deepee XML 1 July 25th, 2006 10:35 AM
Reading line by line from a .txt file x_ray VB.NET 2002/2003 Basics 5 February 10th, 2006 01:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.