You will find in the test folder of the library source archive a test/example program which uses this library.
#include <ticables.h> #include <tifiles.h> #include <ticalcs.h> static void print_lc_error(int errnum) { char *msg; ticables_error_get(errnum, &msg); fprintf(stderr, "Link cable error (code %i)...\n<<%s>>\n", errnum, msg); free(msg); } int main(int argc, char **argv) { CableHandle* cable; CalcHandle* calc; int err; // init libs ticables_library_init(); ticalcs_library_init(); // set cable cable = ticables_handle_new(CABLE_BLK, PORT_2); if(cable == NULL) return -1; // set calc calc = ticalcs_handle_new(CALC_TI83); if(calc == NULL) return -1; // attach cable to calc (and open cable) err = ticalcs_cable_attach(calc, cable); err = ticalcs_calc_isready(h); if(err) print_lc_error(err); printf("Hand-held is %sready !\n", err ? "not " : ""); // detach cable (made by handle_del, too) err = ticalcs_cable_detach(calc); // remove calc & cable ticalcs_handle_del(calc); ticables_handle_del(cable); return 0; } |