Я получаю некоторые раздражающие предупреждения при попытке подключиться к базе данных Mysql.
Вот код:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <mysql/mysql.h>
#include <string.h>
const char* host = "localhost";
char *database="Dbis_RG";
char user_name[10];
char passwd[10];
MYSQL_ROW row;
MYSQL_RES* result;
MYSQL_FIELD* field;
int main ()
{
system("clear");
printf("Insert yur user name: \n");
scanf("%s", &user_name);
printf("Insert your passwd: \n");
scanf("%s", &passwd);
MYSQL *conn;
conn = mysql_init(NULL);
/* Connection to database */
if (!mysql_real_connect(conn, host,
user_name, passwd, database, 0, NULL,CLIENT_MULTI_STATEMENTS)) {
fprintf(stderr, "%s\n", mysql_error(conn));
exit(EXIT_SUCCESS);
}
printf ("Connection successful.\n");
}
На самом деле я получаю эти предупреждения, но я нене понимаю, как я могу от них избавиться:
1.0.c: In function ‘main’:
1.0.c:23: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[10]’
1.0.c:26: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[10]’
Большое спасибо
Мауро