no output with MySQL C API

This is a discussion on no output with MySQL C API within the C Programming forums, part of the General Programming Boards category; here's my code Code: #include <stdio.h> #include <mysql.h> MYSQL db; int main( int argc, char *argv[] ) { fprintf( stderr, ...

  1. #1
    Registered User trekker's Avatar
    Join Date
    Mar 2002
    Posts
    46

    no output with MySQL C API

    here's my code
    Code:
    #include <stdio.h>
    #include <mysql.h>
    
    MYSQL db;
    
    int main( int argc, char *argv[] )
    {
            fprintf( stderr, "hello" );
    
            mysql_init( &db );
    
            mysql_real_connect( &db, "host", "user", "passwd", "database", 0, NULL, 0 );
    
            fprintf( stderr, "%d\n", mysql_ping( &db ) );
    
            mysql_close( &db );
    
            return 0;
    }
    compiles and links without any error

    Code:
    gcc -c -I/usr/local/mysql4/include/mysql test.c
    gcc -o test test.o -L/usr/local/mysql4/lib/mysql -lmysqlclient
    When i use gcc to compile a simple C file with no embedded MySQL
    and without the above options it runs perfectly.

    it's the first time i use gcc and try to work on a Unix environment

    any help would be greatly appreciated,
    thanks
    to boldy code where...

  2. #2
    Registered User trekker's Avatar
    Join Date
    Mar 2002
    Posts
    46
    well, perhaps i wasn't clear.

    when i say no output i mean that not even the

    Code:
    ...
    fprintf( stderr, "hello" );
    ...
    statement works.

    The only status the MySQL functions return, as far as i know,
    can be checked only through the mysql_errno() and mysql_error()
    functions which don't work, too.

    thanx
    to boldy code where...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MySQL C API Header File Problems
    By WarrenKeyes3 in forum C Programming
    Replies: 3
    Last Post: 03-26-2009, 02:26 PM
  2. MySQL libraries
    By csonx_p in forum C++ Programming
    Replies: 6
    Last Post: 10-02-2008, 02:23 AM
  3. Replies: 4
    Last Post: 11-30-2005, 03:44 PM
  4. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21