¶Á¡¶c³ÌÐòÉè¼ÆÓïÑÔ¡·Ò»Ð©¸ÐÊÜ
×î½üÔÚ¿´¡¶c³ÌÐòÉè¼ÆÓïÑÔ¡·£¬¾ÍÊÇÄDZ¾±»ÓþΪCÓïÑÔÊ¥¾µÄÊé¼®¡£¼¸Ìì¿´ÁËÒ»Õ£¬¸Ð´¥ºÜ´ó£¬¿ªÆª¾ÍÉæ¼°µ½ºÜ¶àʵÓóÌÐò£¬²»ÏñÌ·ºÆÇ¿ÄÇÑùÈÃÈËÉîÏÝÓ﷨ϸ½ÚÖ®ÖУ¬¶øÇÒѧÍêÌ·µÄÊé¸Ð¾õʲô¶¼²»ÄÜ×ö¡£ºÜ¶àÎÊÌâÌ·¶¼»Ø±ÜÁË¡£Ëùνרҵ¿´¿´c³ÌÐòÉè¼ÆÓïÑԵĴúÂëµÄ·ç¸ñ¾ÍÄܸÐÊܵ½£¬Ò»ÖÖ¾«Ðĵñ×ÁµÄÒÕÊõÆ·¡£µÚÒ»ÕÂÓÐÒ»¸ö¼òµ¥µÄÎÊÌ⣬¾ÍÊǰÑ×Ö·û´®Óжà¸ö¿Õ¸ñµÄÓÃÒ»¸ö¿Õ¸ñ´úÌæ£¬×Ô¼ºÐ´ÁËÒ»ÖÖ£¬ºóÀ´¿´Á˴𰸣¬¸Ð¾õ×Ô¼ºÆäʵ°Ñ¼òµ¥µÄÎÊÌ⸴ÔÓ»¯ÁË£¬Õâ»òÐí¾ÍÊÇ´óÅ£ÓëÎÒÕâÑù²ËÄñµÄ²î±ð¡£ÏÂÃæÊÇÎÒ×Ô¼ºµÄ³ÌÐò.#include<stdio.h>
int main(void)
{
int c;
int count;
while((c=getchar())!=EOF)
{
if(c==' ') count++;
else
{
putchar(c);
count==0;
}
if(count==1) putchar(' ');
}
}
Ïà¹ØÎĵµ£º
SelectÔÚSocket±à³ÌÖл¹ÊDZȽÏÖØÒªµÄ£¬¿ÉÊǶÔÓÚ³õѧSocketµÄÈËÀ´Ëµ¶¼²»Ì«°®ÓÃSelectд³ÌÐò£¬ËûÃÇÖ»ÊÇϰ¹ßдÖîÈç connect¡¢accept¡¢recv»òrecvfromÕâÑùµÄ×èÈû³ÌÐò£¨Ëùν×èÈû·½Ê½block£¬¹ËÃû˼Ò壬¾ÍÊǽø³Ì»òÊÇÏß³ÌÖ´Ðе½ÕâЩº¯Êýʱ±ØÐëµÈ
´ýij¸öʼþµÄ·¢Éú£¬Èç¹ûʼþûÓз¢Éú£¬½ø³Ì»òÏ߳̾ͱ»×èÈû£¬º¯Êý²»ÄÜÁ¢¼´·µ» ......
ÎÊÌâÃèÊö£ºÐ´Ò»¸öº¯Êý£¬½ÓÊÜÒ»¸öÕûÊý£¨¼Ù¶¨ÓÃint±íʾ£©£¬Êä³ö¸ÃÕûÊýµÄ×Ö·û´®ÐÎʽ¡£²ÉÓÃÈçϺ¯ÊýÔÐÍ£º
void itoa ( int val, char* buf );
ÕâÀï¼Ù¶¨buf×ã¹»´óÒÔÈÝÄÉÈκÎintÀàÐÍÊýÖµµÄ×Ö·û´®¡£
Õâ¸öÎÊÌ⣬³õ¿´ºÃÏñûÓÐʲôÄѶȡ£Èç¹ûÊÇ0£¬¾ÍÖ±½ÓÊä³ö'0'£»Èç¹ûÊÇÕýÊý£¬¾Íͨ¹ýȡģ(%)ºÍÇóÉÌ(/)ÔËËã¿ÉÒÔÖðλȡµÃ¸ÃÕûÊýµÄÊ ......
/*
============================================================================
Name : test.c
Author : alf
Version :
Copyright : Your copyright notice
  ......
¼ÙÉèÎÒÃÇʹÓÃmysql_real_queryÖ´ÐÐÁËÒ»ÌõsqlÓï¾äÖ®ºó£¬·µ»ØÖµÎª·Ç0Öµ£¬´ó¼Ò¶¼ÖªµÀÕâÊÇÕâÌõÓï¾äÖ´Ðгö´í£¬µ«ÊÇÎÒÃÇÏë
ÁË½âµØ¸üÏêϸµãµÄ»°£¬¾¿¾¹ÊÇʲôÔÒòµ¼ÖÂÁËÕâ¸ö´íÎóÄØ£¿Õâʱºò¾ÍµÃÓÃÉÏmysqlÌṩµÄÁíÍâÒ»¸öAPI£ºmysql_errno¡£
mysql_errno»áÌṩ×î½üÒ»´Îµ÷ÓõÄC API³ö´íµÄÐÅÏ¢£¨²»¼ûµÃÿ¸öAPI¶¼»á¶ÔÕâ¸öerrno½øÐÐÉèÖ ......
CºÍÖ¸Õë
ÔÚCÖÐÓÐÒ»¸öºÜÖØÒªµÄ¸ÅÄ»òÐí´ó¼Ò¶¼ÖªµÀ£¬ÄǾÍÊÇÖ¸Õë¡£Ôںܶà³õѧÕ߸սӴ¥CµÄʱºò¶¼ÈÏΪÕâÊÇ×îÄѵÄ֪ʶµãÁË¡£Ã»´í£¬ÎÒ¸Õ¿ªÊ¼Ñ§µÄʱºòÒ²ÊÇÕâôÏëµÄ£¬ÉÏÁ˵ÚÒ»½Ú¿Îºó£¬µÚÒ»¸ÐÊܾÍÊÇ£ºÌì°¡£¬Õâ¼òÖ±¾ÍÊÇÌìÊ飡ÓÉÓÚ¸öÈ˶ÔÓÚCµÄ°®ºÃ£¬¾¹ýÒ»¶Îʱ¼äµÄѧϰºÍÑо¿Ö®ºó£¬·¢ÏÖÕâÒ»¿éÊÇÎÒ×îϲ»¶µÄ£¬²¢ÇÒÖð²½·¢ÏÖÕâÒ²ÊDZ¾È赀 ......