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

linux c++Á¬½ÓmysqlʾÀý

 
¡¡±àÒëºÍÁ¬½Ó³ÌÐò
¡¡¡¡MySQLÖÐÓÐÒ»¸öÌØÊâµÄ½Å±¾,½Ð×ömysql_config. Ëü»áΪÄã±àÒëMySQL¿Í»§¶Ë,²¢Á¬½Óµ½MySQL·þÎñÆ÷ÌṩÓÐÓõÄÐÅÏ¢.ÄãÐèҪʹÓÃÏÂÃæÁ½¸öÑ¡Ïî.
¡¡¡¡1. --libs Ñ¡Ïî - Á¬½ÓMySQL¿Í»§¶Ëº¯Êý¿âËùÐèÒªµÄ¿âºÍÑ¡Ïî.
¡¡¡¡$ mysql_config --libs
¡¡¡¡2. --cflags Ñ¡Ïî - ʹÓñØÒªµÄincludeÎļþµÄÑ¡ÏîµÈµÈ.
¡¡¡¡$ mysql_config --cflags
¡¡¡¡ÄãÐèÒª½«ÉÏÃæÁ½¸öÑ¡Ïî¼ÓÈëµ½¶ÔÔ´ÎļþµÄ±àÒëÃüÁîÖÐ. ËùÒÔ,Òª±àÒëÉÏÃæµÄ³ÌÐò,ҪʹÓÃÏÂÃæµÄÃüÁî:
¡¡¡¡$ g++ -o output-file $(mysql_config --cflags) test.c $(mysql_config --libs)
¡¡¡¡Ö´ÐбàÒëºóµÄ³ÌÐò:
¡¡¡¡$ ./output.file
#include <mysql.h>
#include <stdlib.h>
#include <stdio.h>
static char *server_args[] =
{
"this_program", /* this string is not used */
"--datadir=.",
"--key_buffer_size=32M"
};
static char *server_groups[] =
{
"embedded",
"server",
"this_program_SERVER",
(char *)NULL
};
int main(void)
{
if (mysql_server_init(sizeof(server_args) / sizeof(char *),
server_args, server_groups))
exit(1);
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char *server = "localhost";
char *user = "admin";
char *password = "metrics"; /* ´Ë´¦¸Ä³ÉÄãµÄÃÜÂë */
char *database = "test";
conn = mysql_init(NULL);
/* Connect to database */
if (!mysql_real_connect(conn, server,
user, password, database, 0, NULL, 0))
{
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
/* send SQL query */
if (mysql_query(conn, "show tables"))
{
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
res = mysql_use_result(conn);
//utput table name */
printf("MySQL Tables in mysql database:\n");
while ((row = mysql_fetch_row(res)) != NULL)
printf("%s \n", row[0]);


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(20)

C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
 
1.     setallpalletteº¯Êý
setallpalletteº¯ÊýµÄ¹¦ÄÜÊÇ°´Ö¸¶¨·½Ê½¸Ä±äËùÓеĵ÷É«°åÑÕÉ«£¬ÆäÓ÷¨Îª£ºvoid far setallpallette(struct palette, fa ......

C/C++Öеİ´Öµµ÷ÓÃÓë°´ÒýÓõ÷ÓÃ

 Ðí¶à±à³ÌÓïÑÔÖеĵ÷Óú¯ÊýµÄÁ½ÖÖ·½·¨ÊÇ°´Öµµ÷ÓÃ(call-by-value)ºÍ°´ÒýÓõ÷ÓÃ(call-by-reference)¡£
²ÎÊý°´Öµµ÷Óô«µÝʱ£¬Éú³É²ÎÊýÖµ¸±±¾²¢ÇÒ´«¸ø±»µ÷Óú¯Êý£¬¸±±¾µÄ¸Ä±ä²¢²»Ó°Ïìµ÷ÓÃÕßµÄԭʼ±äÁ¿Öµ£¬ÕâÑù¾Í¿ÉÒÔ·ÀÖ¹ÒâÍâµÄ¸±×÷ÓÃÓ°Ï쿪·¢ÕýÈ·£¬¿É¿¿µÄϵͳ¡£°´Öµµ÷ÓõÄÒ»¸öȱµãÊÇ£¬Èç¹û´«µÝ½Ï´óµÄÊý¾ÝÏÔò¸´ÖÆÕâ¸öÊý ......

linux vimµÄÓ÷¨

 
ÔÚlinux
ÏÂдns´úÂëÒÔ¼°tcl²âÊԽű¾£¬¹Û²ìtraceÎļþµÈ¶¼ÉÙ²»ÁËÓÃvim¡£vimÊÇÒ»¸ö¸ßЧµÄä¯ÀÀ¹¤¾ß¡£ÓкܶàʹÓü¼ÇÉ£¬ÔÚ´Ë£¬×ªÔØÒ»¸öÓ÷¨¼ò½é¡£
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
ÏÈÉÔΪ½éÉÜһϠvim. vi ÊÇ unix/linux
ϼ«ÎªÆÕ±éµÄÒ»ÖÖÎı¾±à¼­Æ÷, ´ó²¿·Ö»ú ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ