#include "cbthr.h"
#include <stdio.h>
#include <wchar.h>
Go to the source code of this file.
Data Structures | |
struct | t_cbgpx |
Functions | |
short | cbgpx_isvalid (const t_cbgpx *aHandle) |
Checks, if the given handle of the GPX file is valied. | |
short | cbgpx_opena (t_cbgpx *theHandle, const char *aFileName) |
Opens the given file as a GPX file, ANSI file name. | |
short | cbgpx_openw (t_cbgpx *theHandle, const wchar_t *aFileName) |
Opens the given file as a GPX file, wide char file name. | |
void | cbgpx_close (t_cbgpx *aHandle) |
Closes the GPX file. | |
short | cbgpx_write (t_cbgpx *aHandle, double aLat, double aLon, double anAlt) |
Writes the given coordinates into the GPX file. |
See also GPX: The GPS exchange format , http://www.topografix.com/gpx.asp.
Example: the following code:
#include "cbgpx.h" int main() { t_cbgpx hgpx; if (cbgpx_opena(&hgpx, "test.gpx") != 0) { cbgpx_write(&hgpx, 49.2, 11.7, 403.6); ... cbgpx_write(&hgpx, 49.5, 12.2, 398.3); cbgpx_close(&hgpx); } }
<?xml version="1.0"?> <gpx xmlns="http://www.topografix.com/GPX/1/0"> <time>2008-11-23T16:40:07Z</time> <wpt lat="49.2" lon="11.7"> <ele>403.6</ele> <time>2008-11-23T16:46:09Z</time> <name>0</name> <desc>0</desc> <sym>Dot</sym> <type>Dot</type> </wpt> <!-- ... --> <wpt lat="49.5" lon="12.2"> <ele>398.3</ele> <time>2008-11-23T17:05:51Z</time> <name>275</name> <desc>275</desc> <sym>Dot</sym> <type>Dot</type> </wpt> <bounds minlat="49.2" minlon="11.7" maxlat="49.5" maxlon="12.2" /> </gpx>
void cbgpx_close | ( | t_cbgpx * | aHandle | ) |
Closes the GPX file.
The function writes the following closing information into the GPX file
aHandle | the handle of the GPX file to close. |
short cbgpx_isvalid | ( | const t_cbgpx * | aHandle | ) |
Checks, if the given handle of the GPX file is valied.
aHandle | pointer to the handle to check |
short cbgpx_opena | ( | t_cbgpx * | theHandle, | |
const char * | aFileName | |||
) |
Opens the given file as a GPX file, ANSI file name.
The function opens the given file and writes the following initial information into it:
<?xml version="1.0"?> <gpx xmlns="http://www.topografix.com/GPX/1/0"> <time>[current time]</time>
theHandle | the resulting handle of the GPX file. | |
aFileName | the name of the file to open. |
short cbgpx_openw | ( | t_cbgpx * | theHandle, | |
const wchar_t * | aFileName | |||
) |
Opens the given file as a GPX file, wide char file name.
Converts the given file name into multibyte and uses cbgpx_opena() in order to open the GPX file.
theHandle | the resulting handle of the GPX file. | |
aFileName | the name of the file to open. |
short cbgpx_write | ( | t_cbgpx * | aHandle, | |
double | aLat, | |||
double | aLon, | |||
double | anAlt | |||
) |
Writes the given coordinates into the GPX file.
The function writes the following information into the GPX file:
<wpt lat="[latitude]" lon="[longitude]"> <ele>[altitude]</ele> <time>[current time]</time> <name>0</name> <desc>0</desc> <sym>Dot</sym> <type>Dot</type> </wpt>
aHandle | the GPX file handle. | |
aLat | the latitude, positive for North, negative for South, decimal degrees. | |
aLon | the longitude, positive for East, negative for West, decimal degrees. | |
anAlt | the altitude in meters. |