C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 20th, 2003, 04:38 AM
trekker trekker is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 2 trekker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old May 21st, 2003, 01:43 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,536 Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 6 h 45 m 12 sec
Reputation Power: 876
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Embedded C MySQL client gives no output


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway