CSharp/C# >> Readline from Textfile beginning at the end of the file

by RnJhbmsgVXJheQ » Mon, 01 Sep 2008 22:56:01 GMT

Hi all

I am opening and looping a text file like this:

System.IO.FileStream local_FileStream = new
System.IO.FileStream(local_PathFile, System.IO.FileMode.Open,
System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
System.IO.StreamReader local_StreamReader = new
System.IO.StreamReader(local_FileStream);

while (local_StreamReader.ReadLine() != null)
{}

Does anybody knows how to read a text file beginning
at the end of the file ??

Thanks for any comments
Best regards
Frank Uray

CSharp/C# >> RE: Readline from Textfile beginning at the end of the file

by RmFtaWx5IFRyZWUgTWlrZQ » Mon, 01 Sep 2008 23:54:01 GMT


I really think that using File.ReadAllLines() and reversing through the array
would be easier. Easier unless the files are extremely large, I guess...

Similar Threads

1. Open files closed or rearranged when I begin/end debugging

I've been expriencing a really annoying issue whenever I start/stop the 
debugger.

Almost every time I start or stop the debugger, some of the files that are 
currently open are closed, and sometimes the tab order of the open files is 
rearranged.  It's almost like the IDE is tracking two "sets" of open files - 
one for when I'm debugging, and one for when I'm not.  It seems to switch 
between these "sets" whenever I start/stop the debugger.  When it does this, 
it seems to sometimes "lose" some of the files that were part of that "set".  
If any of the files that are automatically closed were modified, the changes 
are lost (it does not prompt me to save changes, as it normally does).  Is 
this a known issue?  How can I fix this?

VS.NET 2003, XP SP2
this happens when debugging unmanaged C++ code
Using "Tabbed Documents"
This happens on every machine I've worked on
Not sure what other info is relevant.

Any help is appreciated!

2. Ending a Console.ReadLine() in C# - CSharp/C#

3. StreamReader ReadLine alternate End Of Line

StreamReader is not customizable for EOL.  You can create a custom
class that extends StreamReader and overrides the ReadLine method and
makes EOL customizable.  Use Reflector to get the original code for
ReadLine and then modify it accordingly.

HTH,

Sam


------------------------------------------------------------
We're hiring!  B-Line Medical is seeking Mid/Sr. .NET 
Developers for exciting positions in medical product 
development in MD/DC.  Work with a variety of technologies
in a relaxed team environment.  See ads on Dice.com.



On Thu, 7 Dec 2006 09:17:01 -0800, R. A. Gates <R. A.
 XXXX@XXXXX.COM > wrote:

>Question: Is it possible to specify a specific EOL character(s) for ReadLine 
>to determine the end of the line?
>
>I'm reading a CSV file that has a X'0D' inside a quoted portion of the 
>string. (The data is being provided by the customer so I have no control over 
>the format of the contents. )
>
>The end of line marker is X'0D' X'0A' or "\r\n". My first ReadLine picks up 
>the characters of the string up to the first X'0D'. The second ReadLine picks 
>up the rest of the line. 
>
>I could read the entire file as a stream and then split on the X'0D' X'0A' 
>but I'm already going to have to split the sting on ',' to parse the data and 
>I'm trying to avoid parsing the data twice. (and I'd like to avoid rewriting 
>my code if I can)
>
>Any help on this is greatly appreciated.
>Thanks!

4. asynchronous web method calls - begin without end - CSharp/C#

5. Given the week, get the begin date and the end date

Hi,

Given the week (for e.g., 27) , can i get the begin date 
of that week and the end date of that week in the given 
year.

any idea?

Thanks
Reb

6. DataGridView - force begin and end edit - CSharp/C#

7. Problems with a std::vector (begin and end): Different behavior debug and release version

Windows XP / Visual Studio 2005
-----------------------------------

Hi

This is a code piece from an automatic generated C++ file in gSOAP:

SOAP_FMAC3 int SOAP_FMAC4 soap_out_std__vectorTemplateOfstd__string(struct
soap *soap, const char *tag, int id, const std::vector<std::string >*a,
const char *type)
{
    for (std::vector<std::string >::const_iterator i = a->begin(); i !=
a->end(); ++i)
    {
        if (soap_out_std__string(soap, tag, id, &(*i), ""))
            return soap->error;
    }
    return SOAP_OK;
}

I have a different behaviors in the debug and release version of the
application! The vector contains one element.

DEBUG:
The for loop is called one time, as it should be.

RELEASE:
The for loop is NEVER called, because the iterator i is a->end().

I have no idea why. I detect this with log files.

Interesting is the follow: I tried to reproduce this behavior in my own
code. The behavior in my code is correct, in the release and in the debug
version.

Any ideas?
A comiler option?
An include?

Thanks for any hints.
Hans



8. std::vector : begin, end and insert - Using Objects instead of ints