|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Embedded C MySQL client gives no output
I'm trying to make work a C MySQL client on a Unix server/client
environment through terminal. I have restricted access(username/password) to a specific database to which I connect with no problem using the 'mysql' cmdline tool. I write a simple C program ( connect/disconnect ) Code:
#include <stdio.h>
#include <mysql.h>
int main( int argc, char *argv[] )
{
MYSQL *db;
printf( "just checking..." );
db = mysql_init( NULL );
if( mysql_real_connect( db, server, NULL, NULL, NULL, 0, NULL, 0 ) )
fprintf( stderr, mysql_error( db ) );
printf( "%d\n", mysql_ping( db ) );
mysql_close( db );
return 0;
}
I manage to successfully build and link it with gcc but when i execute the produced binary it gives no output, not even the "just checking" printf() message. i've posted the same question on the MySQL forum, but no luck. any suggestion would be greatly appreciated, thanks |
|
#2
|
||||
|
||||
|
Try changing that printf( "just checking..." ); to either:
printf( "just checking...\n" ); or fprintf(stderr, "just checking...\n"); When your terminal is running in cooked mode (as is usually the case), it buffers input, which is why I suspect you aren't seeing the message. Hope this helps ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Embedded C MySQL client gives no output |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|