As far as I can tell, this method is returning a blank line every other line, but I can't figure out why:

public static List<string> plain(string path, int num)
        {
            List<string> result = new List<string>();
            StreamReader reader = File.OpenText(path);
            string line;
            int i = 0;
            while ((line = reader.ReadLine()) != null)
            {
                result.Add(line);
                i++;
                if (i == num) { break; }
            }
            return result;
        }

Does anyone have an idea? I'm sure it's something simple I'm overlooking :).

Your function is correctly returning a list of at most 'num' lines in the file. There were no blank lines. You might want to recheck other parts of the program.

Yeah .. it also works fine here.

P.S. Are you sure, that your file, which lays in path has text in it (maybe this is that simple, that you're overlooking :P)?

In that case you might want to use this:

line.Replace("\\r\\r\\n", "");

That should fix it :-)

Yeah I just wrote a Python script to fix the files. Python's pretty quick to write, this is the first time it has frustrated me :).

This question has already been answered. Start a new discussion instead.