how to get the data of lat and lon of tinygps.h library

:confused:
how to get the actual data of lat and lon of tinygps.h library without error

If you use this library, then you should have a look at the examples provided

  float flat, flon;
  unsigned long age, date, time, chars = 0;
  gps.f_get_position(&flat, &flon, &age);

But there is another better library called TinyGPS++, which you may find more useful

Usage
Let’s say you have an Arduino hooked to an off-the-shelf GPS device and you want to display your altitude. You would simply create a TinyGPS++ instance like this:

#include "TinyGPS++.h"
TinyGPSPlus gps;
Repeatedly feed it characters from your GPS device:

while (ss.available() > 0)
gps.encode(ss.read());
Then query it for the desired information:

if (gps.altitude.isUpdated())
Serial.println(gps.altitude.meters());

As a simple example, here’s how easy it is to print out the current latitude, longitude, and altitude in TinyGPS++:

Serial.print("LAT="); Serial.println(gps.location.lat(), 6);
Serial.print("LONG="); Serial.println(gps.location.lng(), 6);
Serial.print("ALT="); Serial.println(gps.altitude.meters());

What do you mean by "without error"? The values determined by the GPS receiver and delivered to your sketch via the TinyGPS functions are what they are. The lon is the lon and the lat is the lat. There will be varying inaccuracies but what do you want/

John.