Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Reply-To: From: "Terry Orgill" To: Subject: cygwin, fltk, mysql Date: Mon, 23 Feb 2004 10:08:35 -0800 Message-ID: <00c501c3fa38$0edd42c0$2201a8c0@stribus> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00C6_01C3F9F5.00BA02C0" X-IsSubscribed: yes Note-from-DJ: This may be spam ------=_NextPart_000_00C6_01C3F9F5.00BA02C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I am trying to develop an application using cygwin, fltk and mysql. The source is attached. I can add data without any problem, but the program core dumps on inquires. I tried the same thing without fltk and it still core dumps. I have tried both mysql 3.23.58 and 4.0.17. I am using gcc 3.3.1. ------=_NextPart_000_00C6_01C3F9F5.00BA02C0 Content-Type: application/octet-stream; name="ctest.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ctest.cpp" #include #include #include #include #include #include #include #include #include #include #include #include Fl_Input* fname; Fl_Input* faddress; Fl_Input* faddress2; Fl_Input* fcity; Fl_Input* fstate; Fl_Input* fzip; Fl_Window* window; Fl_Button* add_button; Fl_Button* inq_button; Fl_Button* exit_button; char name[255], address[255], address2[255], city[255], state[255]; char *query; char zip[255]; static MYSQL mydata; static MYSQL_RES *res; static MYSQL_ROW row; static int num_fields; void add(Fl_Widget *w, void*) { strcpy(name,fname->value()); strcpy(address,faddress->value()); strcpy(address2,faddress2->value()); strcpy(city,fcity->value()); strcpy(state,fstate->value()); strcpy(zip,fzip->value()); query=3D(char *)malloc(1024); sprintf(query,"INSERT into customer(name,address,address2,city,state,zip) = VALUES ('%s','%s','%s','%s','%s','%s')",name,address,address2,city,state,zi= p); if(mysql_real_query(&mydata, query, strlen(query))) printf(mysql_error(&mydata)); free(query); } void inquire(Fl_Widget *w, void*) { strcpy(name,fname->value()); query=3D(char *)malloc(1024); sprintf(query,"SELECT * FROM customer where name =3D '%s'",name); if(mysql_real_query(&mydata, query, strlen(query))) printf(mysql_error(&mydata)); res=3Dmysql_store_result(&mydata); row=3Dmysql_fetch_row(res); strcpy(name,row[1]); strcpy(address,row[2]); strcpy(address2,row[3]); strcpy(city,row[4]); strcpy(state,row[5]); strcpy(zip,row[6]); fname->value(name); faddress->value(address); faddress2->value(address2); fcity->value(city); fstate->value(state); fzip->value(zip); } void getout(Fl_Widget *w, void*) { mysql_close(&mydata); exit(0); } void myinit() { mysql_init(&mydata); if(!mysql_real_connect(&mydata, "192.168.1.200", "ODBC", "lauren", "java",= 0,NULL,0)) printf(mysql_error(&mydata)); } void paint_screen() { window =3D new Fl_Window(800,500,"Main Customer"); fname =3D new Fl_Input(100,10,250,20,"Name"); faddress =3D new Fl_Input(100,40,250,20,"Address"); faddress2 =3D new Fl_Input(100,70,250,20,"-"); fcity =3D new Fl_Input(100,100,150,20,"City"); fstate =3D new Fl_Input(300,100,20,20,"State"); fzip =3D new Fl_Input(400,100,85,20,"Zip Code"); add_button =3D new Fl_Button(600,300,150,20,"Add Customer"); add_button->callback(add,0); inq_button =3D new Fl_Button(600,350,150,20,"Inquire Customer"); inq_button->callback(inquire,0); exit_button =3D new Fl_Button(600,400,150,20,"Exit Program"); exit_button->callback(getout,0); window->end(); } int main(int argc, char **argv) { myinit(); paint_screen(); window->show(argc, argv); return Fl::run(); } ------=_NextPart_000_00C6_01C3F9F5.00BA02C0 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPart_000_00C6_01C3F9F5.00BA02C0--