// compile with// gcc connect_example.c -o connect_example -ltaos#include <stdio.h>#include <stdlib.h>#include "taos.h"intmain(){constchar*host="localhost";constchar*user="root";constchar*passwd="taosdata";// if don't want to connect to a default db, set it to NULL or ""constchar*db=NULL;uint16_tport=0;// 0 means use the default portTAOS*taos=taos_connect(host,user,passwd,db,port);if(taos==NULL){interrno=taos_errno(NULL);char*msg=taos_errstr(NULL);printf("%d, %s\n",errno,msg);}else{printf("connected\n");taos_close(taos);}taos_cleanup();}