Example showing how to add XYZ data to existing Gwyddion XYZ file. Number of channels must be the same. First use gwyscan_save_gwyddion_xyz() to create XYZ file when not existing. Then you can periodically call gwyscan_add_gwyddion_xyz() to create one big XYZ file.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <stdio.h>
#include <assert.h>
int main()
{
int xres = 1234;
int yres = 1234;
double *xydata1, *zdata1;
double *xydata2, *zdata2;
double *xydata3, *zdata3;
char *desc[] = { "Data" };
char *desc1[] = { "Data 1" };
char *desc2[] = { "Data 2" };
char *desc12[] = { "Data1", "Data2" };
int n1 = 160;
int n2 = 160000;
int n3 = 160000;
int channels = 8;
int n_total = 123;
xydata1 = (double *)malloc(2 * n1 * sizeof(double));
zdata1 = (double *)malloc(n1 * sizeof(double));
xydata2 = (double *)malloc(2 * n2 * sizeof(double));
zdata2 = (double *)malloc(n2*sizeof(double));
xydata3 = (double *)malloc(2 * n3 * sizeof(double));
zdata3 = (double *)malloc(n3 * sizeof(double));
free(xydata1);
free(zdata1);
free(xydata2);
free(zdata2);
free(xydata3);
free(zdata3);
return 0;
}