Skip to main content
There was an error on line 9: stm.ReadLine( ); became inp_stm.ReadLine( );
Source Link

C# Version.

using System.IO;

void readTextFile(string file_path)
{
   StreamReader inp_stm = new StreamReader(file_path);

   while(!inp_stm.EndOfStream)
   {
       string inp_ln = stminp_stm.ReadLine( );
       // Do Something with the input. 
   }

   inp_stm.Close( );  
}

EDIT: (Fixed an error on line 9; changed "stm.ReadLine();" to "inp_stm.ReadLine();")

C# Version.

using System.IO;

void readTextFile(string file_path)
{
   StreamReader inp_stm = new StreamReader(file_path);

   while(!inp_stm.EndOfStream)
   {
       string inp_ln = stm.ReadLine( );
       // Do Something with the input. 
   }

   inp_stm.Close( );  
}

C# Version.

using System.IO;

void readTextFile(string file_path)
{
   StreamReader inp_stm = new StreamReader(file_path);

   while(!inp_stm.EndOfStream)
   {
       string inp_ln = inp_stm.ReadLine( );
       // Do Something with the input. 
   }

   inp_stm.Close( );  
}

EDIT: (Fixed an error on line 9; changed "stm.ReadLine();" to "inp_stm.ReadLine();")

Source Link
user43609
  • 158
  • 1
  • 8

C# Version.

using System.IO;

void readTextFile(string file_path)
{
   StreamReader inp_stm = new StreamReader(file_path);

   while(!inp_stm.EndOfStream)
   {
       string inp_ln = stm.ReadLine( );
       // Do Something with the input. 
   }

   inp_stm.Close( );  
}