c# - Is there a way to retrieve the last character of a file without reading line by line? -
I need to retrieve the last character of a file. This can be a line break or one of several special characters. Can I recover this character without parsing it in the whole file? Or there is no way that I can read the whole file in the string without worrying about the line breaks?
I will need to split the contents of the file based on the last character of the file. So if this is a line break then I'll split the strings by '\ n'.
string s = file. Read all text ("test.txt"); String [] split = s.Split (s [s.Length - 1]);
Comments
Post a Comment