How to get the position or line throwing exception
I just started learning the IO class and i would like to know How to get the position or line throwing exception while reading the text file and display the message? I would be thankful if you could help me out.
ali tuncerPosted Apr 24, 2016, 9:36 PM
put another variable to count linenumber :
while(txtIn.Peek() !=-1)
{
if(col[0].Length < 5)
{
}
else
{
Console.WriteLine(linenumber) // this line does not get included
}
linenumber++;
}
Nepethya RanaPosted Apr 21, 2016, 5:45 AM
Nepethya RanaPosted Apr 21, 2016, 5:43 AM
Rahul ChavanPosted Apr 21, 2016, 5:03 AM