libvigicrues  2.0.1
heights.c

A detailed example on how to retreive and handle the 10 last water heights of a station (Morlaix [Lannidy] in this example).

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <vigicrues.h>
static vigicrues_status_t func(const vigicrues_t *p_data, void *param)
{
static int init = 0;
if (init == 0) {
puts("Last 10 water heights for station \"Morlaix [Lannidy]\":");
init = 1;
}
struct tm *p_date = localtime(&(p_data->timestamp));
printf("%.2fm published on %s", p_data->value, asctime(p_date));
}
int main(void)
{
"J260301501", VIGICRUES_HEIGHT, 10,
&func, NULL, VIGICRUES_IGNORE_PARAM,
NULL);
return (status == VIGICRUES_SUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE;
}