/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void cursor_open(int *sqlcode);
void cursor_fetch(int *sqlcode, long int *f1, char *f2);
void cursor_close(int *sqlcode);


int main()
{
    char f2[51];
    long int f1;
    int sqlcode;
    printf("Rdb from C (module)\n");
    cursor_open(&sqlcode);
    for(;;)
    {
        cursor_fetch(&sqlcode, &f1, f2);
        if(sqlcode != 0) break;
        printf("%d %s\n", f1, f2);
    }
    cursor_close(&sqlcode);
    return 0;
}
