View Single Post

  #1 (permalink)  
Old 04-24-2008
nasirgul nasirgul is offline
Member
Yellow Belt
 
Join Date: Mar 2008
Posts: 37
problem while read NMEA.txt file

Hello,
Thank you very much for you peoples efforts in mine previous work.
Please let me know about the NMEA Simulator which I am working on nowadays. I want to develop a simulator which will get data from NMEA.txt file and will show on screen. Mine code is extracting data which I placed in timer and I am facing two problems .
1. when I use this
Code:
str = sr.ReadToEnd();
it will show all mine txt file but it is not updating continuously.
2. When I use this
Code:
 str = sr.ReadLine();
it shows only first line of txt file and it is continuously updating.
All i want to keep on updating continuously mine txt file data which I will use to mine application.
Code:
 private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {       
FileStream gul = new FileStream("C:/GPS.txt.txt", FileMode.Open, FileAccess.Read, FileShare.Read);
StreamReader nasir = new StreamReader(gul);
string str = nasir.ReadLine();
//str = nasir.ReadLine();
while (str != null)
{
    txtResults.Text = str;
    str = nasir.ReadLine();
    //str = nasir.ReadToEnd();
    
}
 }
Hope to hear from u guys.
Regards.
nasir
Reply With Quote