473,395 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Delete the last line of a file?

What would be the most efficient (in terms of performance)
possible way of deleting the last line from a text file in
vb.net. Also can I get a count of the number of lines in
the file from anything?
Jul 19 '05 #1
2 3792
"Ray Cassick \(home\)" <ra***********@adelphia.net> wrote in news:u9Xh
$z*********@tk2msftngp13.phx.gbl:
You would have to read in the file to count all of it's lines.


Unless, of course, each line was equal in size. Then you could just take
the filesize and divide by the line length to get the number of lines.

Jul 19 '05 #2
Agreed.... But he did not mention that, and I hate to assume :)

"Chris Dunaway" <du******@lunchmeatsbcglobal.net> wrote in message
news:Xn**********************************@207.46.2 48.16...
"Ray Cassick \(home\)" <ra***********@adelphia.net> wrote in news:u9Xh
$z*********@tk2msftngp13.phx.gbl:
You would have to read in the file to count all of it's lines.


Unless, of course, each line was equal in size. Then you could just take
the filesize and divide by the line length to get the number of lines.

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Kenneth | last post by:
I have a flat file on the server which I append to from a HTML web form. I need to delete the last line of the flat file before I append though. How do i do that? I have the following code. ...
4
by: Tor Erik Sønvisen | last post by:
Hi How can I read the first line of a file and then delete this line, so that line 2 is line 1 on next read? regards
7
by: Srinivasa T.N. | last post by:
Hi, I want to delete the first 3 lines and last 3 lines of a file. How can I do it? I want to repeat on multiple files.. TIA Regards, Seenu.
6
by: Carol | last post by:
With ASP, I am generating a huge CSV file. It is to large to open in notepad. Can I use the Filesystem Scripting Object to read the very last line of the file and delete the very last...
5
by: | last post by:
Hi all, I've been using C++ for quite a while now and I've come to the point where I need to overload new and delete inorder to track memory and probably some profiling stuff too. I know that...
3
by: Cc | last post by:
how do i delete last append line?
1
by: nasirmajor | last post by:
dear all, Please any urgent help regarding following code. i have the following code ================================================================= public void Delete(Object sender,...
4
by: Ignoramus6539 | last post by:
There were some strange requests to my server asking for config.php file (which I do not have in the requested location). I did some investigation. Seems to be a virus written in perl,...
10
by: Joah Senegal | last post by:
Hello all, I want something that should be realy really simple.... but I dont get it.. searched google and stuf, but found nothing useful. I;m opening a txt-file with a fstream. Now I want to...
0
by: Francesco Pietra | last post by:
I forgot to add that the lines to strip are in present case of the type of the following block HETATM 7007 O WAT 446 27.622 34.356 55.205 1.00 0.00 O HETATM 7008 H1 WAT...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.