Reading of text file lines with pauses every 25 lines

0

I'm doing a program that reads 25 lines of my text file and when I enter it shows me the other 25, it reads the first 25 but when I hit enter the program closes, someone to help me please?

        StreamReader fichero;
        string nombre;
        int i = 0; ;

        Console.Write("Escribe el nombre del fichero (\"fin\"para terminar);");
            nombre = Console.ReadLine();

            if (File.Exists(nombre))

            {

                fichero = File.OpenText(nombre);
                int j = 0;
                while (i <= 25)
                {
                    Console.WriteLine(nombre);
                    nombre = fichero.ReadLine();
                    if (i % 25 == 0)
                    {
                        Console.ReadKey();

                }
                i++;
            }
        Console.ReadKey();

        } 

            else
                Console.WriteLine("No existe");

        }

    }
    
asked by Mari Paz 09.10.2018 в 02:09
source

0 answers