ERROR SEGMENTION FAULT..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#ifdef WIN32
#include <windows.h>
#endif
#include <iostream.h>
#include <stdio.h>
#include <mysql.h>
#define HOST "localhost"
#define USER "root"
#define PASSWD ""
#define DB_NAME "mysql"
int main(int argc, char* argv[]){
MYSQL *mysql = NULL; // Connection handler
MYSQL_RES *result;
MYSQL_ROW row;
mysql = mysql_init(NULL);
if(mysql == NULL) return 0;
if(!mysql_connect(mysql, HOST, USER, PASSWD)){
cout << "Cant connect!" << endl;
return 0;
}else{
cout << "Connected.\n";
}
if(!mysql_query(mysql, "SELECT * FROM mysql.help_topic LIMIT 1")){
cout << "FAILED" << endl;
}
result = mysql_use_result(mysql);
while((row = mysql_fetch_row(result))){
printf("%s %s\n", row[0], row[1]);
}
delete mysql;
delete result;
delete row;
return 0;
}
|
wat is the cause of segmentation fault? Please help me
Topic archived. No new replies allowed.