Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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±à³Ì (Æß) SDPЭÒé

Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖЭÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀЭÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......

[תÌû]LinuxÇý¶¯¿ª·¢Ñ§Ï°µÄһЩ±ØÒª²½Öè

 1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃæ£¬ºóÃæ ......

Enable/Disable Linux mousekeys

 
gcc mousekey.c -lX11 -IX11
´ò¿ªmousekeysÔËÐÐ./a.out
¹Ø±ÕmousekeysÔËÐÐ./a.out 1,ÕâÀïÔÚa.outºóÃæËæ±ã¼ÓÒ»¸ö²ÎÊý¾Í¿ÉÒÔÁË£¬ÒòΪÅжÏÌõ¼þΪ if(argc < 2)
/*********source code***************/
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X ......

(Õª)——linuxµÄÎļþ°²×°Â·¾¶

linuxµÄÎļþ°²×°Â·¾¶
2006Äê07ÔÂ15ÈÕ ÐÇÆÚÁù ÉÏÎç 11:09
Èç¹ûÊDZðÈË·¢²¼µÄ¶þ½øÖưü£¬¿ÉÖ´ÐÐÎļþͨ³£¶¼°²×°µ½ /usr/bin ÏÂÃæ£»Èç¹ûÊÇ×Ô¼º´ÓÔ´´úÂë°²×°µÄ£¬¿ÉÖ´ÐÐÎļþͨ³£¶¼ÔÚ /usr/local/bin ÏÂÃæ£¬³ý·ÇÅäÖÃʱָ¶¨Á˰²×°Î»Öá£
ÀýÈ磺
rpm -ivh xxx1.rpm
¿ÉÖ´ÐÐÎļþͨ³£¶¼°²×°µ½ /usr/bin ÏÂÃæ
./configure (»òÕß ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ