473,569 Members | 3,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Read text file bottom up

Lam
Hi

the default readline method in StreamReader read the text from the top to
bottom
how can I read a text file from the bottom to the top?
Thanks
Nov 17 '05 #1
2 6309
Hi Lam,
you can use the ReadBlock method of StreamReader to read in a block of
data from a specified starting position

ReadBlock(char[], intIndex, intCount);

the char[] is where the data will be read to, intIndex is the starting
position of where to read and intCount is the max number of characters to
read.

You can have a loop which decrements intIndex from max to min which will
read the file backwards.
Hope that helps
Mark.

"Lam" wrote:
Hi

the default readline method in StreamReader read the text from the top to
bottom
how can I read a text file from the bottom to the top?
Thanks

Nov 17 '05 #2
Lam
Thanks
one more question
How can I delete the line after I read in the line from the text file?

"Mark R. Dawson" <Ma*********@di scussions.micro soft.com> wrote in message
news:C9******** *************** ***********@mic rosoft.com...
Hi Lam,
you can use the ReadBlock method of StreamReader to read in a block of
data from a specified starting position

ReadBlock(char[], intIndex, intCount);

the char[] is where the data will be read to, intIndex is the starting
position of where to read and intCount is the max number of characters to
read.

You can have a loop which decrements intIndex from max to min which will
read the file backwards.
Hope that helps
Mark.

"Lam" wrote:
Hi

the default readline method in StreamReader read the text from the top to bottom
how can I read a text file from the bottom to the top?
Thanks

Nov 17 '05 #3

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

Similar topics

4
8032
by: James Aguilar | last post by:
Hey all, I'm working on an encoding scheme where I am running into a problem with reading a file off a stream. Looking at the binary encoding of the file (using a simple hex editor), there is no problem, and the whole file is there. However, when I try to read it from cin, at certain times, cin stops reading. I cannot force cin to go...
2
527
by: Robbie | last post by:
Anybody out there know of a way to read a text file starting from the bottom of the file then going backwards line by line? I am reading large log files in which the data I'm looking for is always near the bottom. I would like something like: StreamReader sr = new StreamReader("MyFile.txt"); string line = sr.ReadLine(-1); <-- this...
4
2724
by: ESPN Lover | last post by:
Below is two snippets of code from MSDN showing how to read a file. Is one way preferred over the other and why? Thanks. using System; using System.IO; class Test { public static void Main()
7
3598
by: J | last post by:
I am new to web design and I am looking for some advice on putting images within paragraphs of text. I have determined that sizing the height of my images to a given number of lines of text seems to work well, however: If for example I align the image to the left, I will then put a border on the top, bottom, and right edges of my image...
6
2047
by: xdeath | last post by:
Hi guys, i've currently got an assignment, whereby, im supposed to create 2 classes, a Vehicle superclass, and a Taxi subclass. Vehicle class needs to have Reg Number, model, price, and Taxi is supposed to inherit those from it. I have done so, but now, it requires that all the data be stored in an array. The final program, should be able...
13
31376
by: =?Utf-8?B?S2VzdGZpZWxk?= | last post by:
Hi Our company has a .Net web service that, when called via asp.net web pages across our network works 100%! The problem is that when we try and call the web service from a remote machine, one outside of our domain, we get the error.. ** Client found response content type of 'text/html; charset=Windows-1252', but expected 'text/xml' **. We...
7
2633
by: Samant.Trupti | last post by:
I need to read a huge file. The content that I want to read are somewhere at the bottom. Can anyone please let me know a way to read the file bottom up? Thanks Trupti
3
6232
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store that multiple worksheet data in different table.How can i do it.Below is my xml file. <?xml version="1.0"?> <Workbook...
3
5378
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store that multiple worksheet data in different table.How can i do it.Below is my xml file. <?xml version="1.0"?> <Workbook...
0
7619
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7681
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.