Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linuxÏÂgtkÖÐʹÓÃCÁ¬½Ómysql

Code:
1.»·¾³ÅäÖÃ
Ò»°ãÇé¿öÏ°²×°ÁËMySQLµÄ»úÆ÷ºÜÉÙ°²×°¿ª·¢°ü£¬Õâ¸öÐèҪעÒâ¡£Ò²¾ÍÊÇÄúÐèÒªÔÚ³ÌÐòÖаüº¬ÕâÑùµÄÓï¾ä£º
#include <mysql.h>
Èç¹ûÔÚ±àÒëµÄʱºòÌáʾº¬ÓÐÀàËÆÓÚÕÒ²»µ½ mysql.h µÄÐÅÏ¢£¬Õâ¾Í˵Ã÷ÄúûÓа²×°Ïà¹Ø¿ª·¢°ü¡£
»¹ÓÐÄú±ØÐ뽨Á¢Ò»¸öÊý¾Ý¿âÓëһЩ±í£¬Õâ¸öÔÚ±¾ÎÄÖлáʹÓá£
2.ÎÒÃÇÏÈÁ´½ÓÊý¾Ý¿â¡£
/****Á¬½Ó****Êý¾Ý¿â****/
#include <mysql.h> /*°üº¬Îļþ*/
MYSQL *myconnect = NULL; /*¶¨ÒåÒ»¸öMYSQLÀàÐ͵ÄÖ¸Õ룬Ëü´ú±íµÄÊÇMySQLÊý¾Ý¿âµÄ²Ù×÷¶ÔÏó*/
GtkWidget *disconnect (void) /*ÕâÀïÊÇÎÒÔ­ÏÈÒ»¸ö³ÌÐòÖÐÓùýµÄº¯Êý£¬²¢²»ÊôÓÚ±¾ÎÄÖصã*/
{
  char *user = "root", *pwd = "", *dbname = "test"; /*ÕâÀïÒª×÷Êʵ±Ð޸ģ¬ÓÃÊý¾Ý¿âÓû§root£¬Óû§ÃÜÂëΪ¿Õ£¬Á¬½ÓtestÊý¾Ý¿â*/
  myconnect = mysql_init(myconnect); /*Óú¯Êýmysql_init³õʼ»¯myconnect*/
  if (mysql_real_connect (myconnect, "localhost", user, pwd,dbname,MYSQL_PORT,NULL,0)== NULL)
  {
   error("δÄÜÁ¬½ÓÉÏÊý¾Ý¿â.");
  }
  /*Óú¯Êýmysql_real_connectÁ¬½ÓÊý¾Ý¿â£¬ËüÐèÒª8¸ö²ÎÊý£¬ÓëÒÔÉ϶ÔÓ¦·Ö±ðÊÇ£º1.³õʼ»¯µÄMySQL½á¹¹£¬2.ËùÒªÁ´½ÓµÄÊý¾Ý¿âµÄIPµØÖ·»òÖ÷»úÃû£¬3.Á´½ÓÊý¾Ý¿âµÄÓû§£¬4.Óû§¿ÚÁ5.Êý¾Ý¿âÃû£¬6.¶Ë¿ÚºÅ£¬ÉϱߵÄMYSQL_PORTÊÇÒ»¸öºê£¬Èç¹ûÒ»Çж¼ÊÇĬÈϵĻ°²»ÓÃÏÔʽ¶¨Ò壬7.Ì×½Ó×Ö£¬Ò»°ãΪNULL£¬8.Õâ¸ö²ÎÊýÒ»°ãΪ0¡£µ±È»£¬²¢²»ÊÇ8¸ö²ÎÊý¶¼±ØÐëдÉÏ£¬Ò»Ð©²ÎÊý¿ÉÒÔÒÔºóÔÙÓá£*/
}
3.µäÐͲÙ×÷
²åÈë²Ù×÷£º
gchar query_buf [100]; /*¶¨ÒåÒ»¸öÊý×éÓÃÀ´´æ·ÅSQLÓï¾ä*/
const gchar *username,*passwd,*passwd_ffirm,*email,*email_ffirm;
................/*ÕâÀïÊ¡ÂÔ¶ÔusernameµÈµÄ¸³ÖµÓï¾ä*/
sprintf (query_buf,"INSERT INTO Users values (\'%s\',\'%s\',\'%s\',\'%s\')",NULL,username,passwd,email);/*½«Óï¾ä´æ·ÅÔÚÊý×équery_bufÖУ¬ÎÒÔÚÊý¾Ý¿âµÄUsers±íÖеÚÒ»¸öÊÇ×Ô¶¯Ôö³¤µÄID£¬ËùÒÔµÚÒ»¸öÐè²åÈëNULL¡£×¢Ò⣺SQLÖеĵ¥ÒýºÅµÈ²»ÄÜÖ±½Ó³öÏÖÔÚCÓïÑÔÖУ¬ÐèÒªÓÃתÒå×Ö·û*/
if (mysql_query (myconnect,query_buf) == 0) /*mysql_queryÖ´Ðк¯ÊýÖ´Ðгɹ¦·µ»Ø0*/
{
  ok("×¢²á³É¹¦.");
}
else
{ error("×¢²áʧ°Ü!¿ÉÄÜÊÇÒѾ­´æÔÚÕâ¸öÓû§Ãû³ÆÁË¡£Çë³¢ÊÔ»»Ò»¸öÓû§Ãû¡£"); }
ɾ³ýµÈ²Ù×÷ÀàËÆ¡£
SELECT²Ù×÷£º
MYSQL_RES *sqlres;


Ïà¹ØÎĵµ£º

¶Ô±È£ºLinuxºÍWindowsϵͳÏ̼߳äµÄÇø±ð


¶Ô±È£ºLinuxºÍWindowsϵͳÏ̼߳äµÄÇø±ð
ÊìϤWIN32±à³ÌµÄÈËÒ»¶¨ÖªµÀ£¬WIN32µÄ½ø³Ì¹ÜÀí·½Ê½ÓëLinuxÉÏÓÐןܴóÇø±ð£¬ÔÚUNIXÀֻÓнø³ÌµÄ¸ÅÄµ«ÔÚWIN32ÀïÈ´»¹ÓÐÒ»¸ö"Ïß³Ì"µÄ¸ÅÄÄÇôLinuxºÍWIN32ÔÚÕâÀ﾿¾¹ÓÐ×ÅʲôÇø±ðÄØ£¿
 
WIN32ÀïµÄ½ø³Ì/Ïß³ÌÊǼ̳Ð×ÔOS/2µÄ¡£ÔÚWIN32À"½ø³Ì"ÊÇÖ¸Ò»¸ö³ÌÐò£¬¶ø"Ïß³Ì"ÊÇÒ ......

Linux¾²Ì¬¿âºÍ¶¯Ì¬¿â

¿â´Ó±¾ÖÊÉÏÀ´ËµÊÇÒ»ÖÖ¿ÉÖ´ÐдúÂëµÄ¶þ½øÖƸñʽ£¬¿ÉÒÔ±»ÔØÈëÄÚ´æÖÐÖ´ÐС£¿â·Ö¾²Ì¬¿âºÍ¶¯Ì¬¿âÁ½ÖÖ¡£ 
¾²Ì¬¿âºÍ¶¯Ì¬¿âµÄÇø±ð
1. ¾²Ì¬º¯Êý¿â
    ÕâÀà¿âµÄÃû×ÖÒ»°ãÊÇlibxxx.a£»ÀûÓþ²Ì¬º¯Êý¿â±àÒë³ÉµÄÎļþ±È½Ï´ó£¬ÒòΪÕû¸ö º¯Êý¿âµÄËùÓÐÊý¾Ý¶¼»á±»ÕûºÏ½øÄ¿±ê´úÂëÖУ¬ËûµÄÓŵã¾ÍÏÔ¶øÒ×¼ûÁË£¬¼´±àÒëºóµÄÖ ......

Çó½ân½×HanoiËþÎÊÌâµÄcº¯Êý

#include <stdio.h>
int Count=0;
void move(char x,int n,char z){
 printf(" %d. disk %d: %c => %c\n",++Count,n,x,z);
}//move
// ½«Ëþ×ùxÉÏ°´Ö±¾¶ÓÉСµ½´óÇÒ×ÔÉ϶øϱàºÅΪ1ÖÁnµÄn¸öÔ²ÅÌ°´¹æÔò°áµ½Ëþ×ùzÉÏ£¬y¿ÉÓÃ×÷¸¨ÖúËþ×ù
void Hanoi(int n,char x,char y,char z){
 if (n==1) move(x,1,z ......

C treeviewÖнڵãÕ¹¿ªÎÊÌâ

ÎÒ´ÓÊý¾Ý¿â¶¯Ì¬¶ÁÈ¡2¸ö¸¸½Úµã£º
111
       a
            a1
       b
            b1
       c
&n ......

windowsÏÂCд·þÎñ»ù±¾¿ò¼Ü

ÎÒ½«ÒµÎñ´úÂëÈ¥µôÁË£¬Ö»ÊÇÓÃÀ´´î¸ö»ù±¾¿ò¼Ü£¬Óõ½µÄʱºòÖ±½ÓÄÃÀ´ÓþͿÉÒÔÁË¡£(ÎÒÕâ¸öÊÇÆðÒ»¸ösocket)Èç¹ûÓÐʲô½¨ÒéÇëÁªÏµÎÒ¡£ChuangshengGuan@Gmail.com
main.c
Code:
#include "Services.h"
int main(int argc, char *argv[])
{
  SERVICE_TABLE_ENTRY ServiceTable[2];
 
  /* Ö¸Ïò±íʾ·þ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ