hi i want to read info from file.but its going into infinete loop.could help me in this
here is the code
here is the code
Code:
#region filecreation and writing data to file
FileInfo fi = new FileInfo(@"c:\\csharppgms\\stdinfo.txt");
StreamWriter sw1 = fi.AppendText();
std:
Console.WriteLine("enter student name:");
string sname = Console.ReadLine();
Console.WriteLine("enter telugu marks:");
int telugu =int.Parse(Console.ReadLine());
Console.WriteLine("enter english marks:");
int english = int.Parse(Console.ReadLine());
Console.WriteLine("enter maths marks:");
int maths = int.Parse(Console.ReadLine());
//writing data to the file
sw1.WriteLine(sname + "|" + telugu + "|" + english + "|" + maths);
Console.WriteLine("do you want to enter more details:y/n");
string s = Console.ReadLine();
if (s.ToLower() == "y")
{
goto std;
}
sw1.Close();
#endregion
#region reading data from file
StreamReader sr1 = fi.OpenText();
while (sr1.ReadLine() != null)
{
Console.WriteLine(sr1.ReadLine());
}
#endregion
Console.Read();
Comment