|
-
Oct 15th, 2006, 03:34 PM
#1
Thread Starter
Frenzied Member
[2.0] quick question 'bout streamreader
how do i read the last line of a document and put it into an array?
double lastLine = code for reading last line;
myArray.SetValue(lastLine, 0);
something like that?.. yea.. quick question. thanks
-
Oct 15th, 2006, 06:00 PM
#2
Re: [2.0] quick question 'bout streamreader
To read the last line of a file using a StreamReader you must first read every other line because a StreamReader is forward-only. There is no way to know how many lines it contins without reading them. The StreamReader's Peek method returns -1 when there is no data remaining, so you can just read a line into a variable in a loop until Peek returns -1. Then the value in the variable is the last line.
-
Oct 15th, 2006, 07:05 PM
#3
Thread Starter
Frenzied Member
Re: [2.0] quick question 'bout streamreader
thank you so much!!!!!! it works now!!! *rates post*
Edit: I must go around and spread other rep first? What if jmc is the only one who helps me VBForums, huh?! huh?!!?!
lol.. sorry jmc =/
-
Oct 15th, 2006, 07:11 PM
#4
Re: [2.0] quick question 'bout streamreader
I don't do it for the rep. I do it for the money that you send me completely voluntarily.
-
Oct 15th, 2006, 07:24 PM
#5
Thread Starter
Frenzied Member
Re: [2.0] quick question 'bout streamreader
hehe.. right....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|