Failed without Reason
Failed without Reason

Reputation: 15

C- Mysql - warning: assignment from incompatible pointer type

connect to MySQL: works fine.

mysql_real_connect(conn, server, user, pass, db, 0, NULL, 0);

I want to do something like

char *status = "";
status = mysql_real_connect(conn, server, user, pass, db, 0, NULL, 0);
printf(stauts);

the above attempt results in compile error:

warning: assignment from incompatible pointer type

Solution is needed.

Upvotes: 0

Views: 78

Answers (1)

Grifplex
Grifplex

Reputation: 302

From the MySQL manual mysql_real_connect returns a MYSQL* connection handler and thus cannot be stored in a char*.

Upvotes: 1

Related Questions