title: How can I implement a gpsd client (in C) to get Latitude, Longitude and Altitude?
body: <p>I am writing a number-crunching data-logging C program for my GPS enabled Raspberry Pi. I grabbed <a href="https://gpsd.io/" rel="nofollow noreferrer">gpsd</a>, and its sample app cgps displays gps information correctly. I wanted to use <a href="https://gpsd.io/libgps.html" rel="nofollow noreferrer">libgps</a> to interface with the daemon so that I could have all that handy information in my app, but I was quickly overwhelmed by the complexity of its API.</p>
  <p>The documentation on its <a href="https://gpsd.io/client-howto.html" rel="nofollow noreferrer">HOWTO page</a> points me to look at <a href="https://gitlab.com/gpsd/gpsd/-/blob/master/clients/cgps.c" rel="nofollow noreferrer">cgps</a> and <a href="https://gitlab.com/gpsd/gpsd/-/blob/master/clients/gpxlogger.c" rel="nofollow noreferrer">gpxlogger</a> for example code, but there's so much coupling that I can't wade through it all. On the opposite end of the spectrum, the C code example on the <a href="https://gpsd.io/libgps.html" rel="nofollow noreferrer">libgps</a> page is so stripped back that it's unusable.</p>
  <p>Can anybody point me to a single class sample that might demystify this? Perhaps something that contains a <code>getCoordinates()</code> function?</p>