- fprintf ( f, "type=\"waypoint\" latitude=\"%f\" longitude=\"%f\" name=\"%s\"", ll.lat, ll.lon, name );
- if ( wp->altitude != VIK_DEFAULT_ALTITUDE )
- fprintf ( f, " altitude=\"%f\"", wp->altitude );
+ s_lat = a_coords_dtostr(ll.lat);
+ s_lon = a_coords_dtostr(ll.lon);
+ fprintf ( f, "type=\"waypoint\" latitude=\"%s\" longitude=\"%s\" name=\"%s\"", s_lat, s_lon, name );
+ g_free ( s_lat );
+ g_free ( s_lon );
+
+ if ( wp->altitude != VIK_DEFAULT_ALTITUDE ) {
+ gchar *s_alt = a_coords_dtostr(wp->altitude);
+ fprintf ( f, " altitude=\"%s\"", s_alt );
+ g_free(s_alt);
+ }