Dear guys,
I was recently programming for GPS data parsing.
GPS data format is as follows:
$GNGGA,152732.60,5257.1205318,N,00111.0161931,W,4,12,0.8,90.514,M,,,0.91,0011*11
I want to read the data line by line and use the Split method in string class to extract the latitude(the number before character 'N'). I used the following code,
string line;
line = sr.ReadLine();
while ((line = sr.ReadLine()) != null)
{
string[] temp = line.Split(',');
Console.WriteLine(temp[2]);
}
but i found the following errors by the compiler.
Index was outside the bounds of the array.
I work on it for one day by reading array tutorial,but i still bother with it.
Anybody know what is the probelm of my code and any solutions that i could extract the information and save in a array and output on the screan line by line? many thanks for your help.