Seppo Mustonen : Programming Survo in C

Functions in library SURVO.LIB

fi_increase_n
Summary

fi_increase_n(s,n_new)
SURVO_DATA_FILE *s;
long n_new;
Description

The fi_increase_n function adds n_new observations to the end of the Survo data file and saves missing values to each defined field in those observations. Also the number of total observations s->n is correspondingly updated.

Return Value

fi_increase_n returns 1 if new observations are succesfully added, -1 otherwise.

Example

The following NEW_OBS command does the same job as the Survo command

FILE INIT <data_file>,<#_of_new_observations> .

/* !NEW_OBS.C 28.10.1991/SM

   NEW_OBS <data>,<# of new observations> 
   <data> must be a Survo data file.
*/

#include <stdio.h> 
#include <stdlib.h> 
#include "survo.h"
#include "survoext.h"
#include "survodat.h"

SURVO_DATA d;

main(argc,argv)
int argc; char *argv[];
        {
        int i;

        s_init(argv[1]);
        i=data_open(word[1],&d); if (i<0) return;
        if (d.type!=2) return; /* If not data file, interrupt */
        i=fi_increase_n(&d.d2,atol(word[2]));
        if (i<0)
            {
            sur_print("\nNot a Survo data file!"); WAIT;
            }
        data_close(&d);
        }


Front page of Survo C libraries