C /C++ ÊäÈëÊä³öÁ÷
Ç°Á½ÌìдC++ʵϰ×÷Òµ£¬Í»È»·¢ÏÖI/OÊÇÄÇôµÄÄ°Éú£¬´òÁ˺ó¤Ê±¼äµÄÎļþ¶¼Ã»Óдò¿ª£¬½ñÌìÖÕÓÚÓеãʱ¼äÁË£¬¾ö¶¨ÕÒ±¾Ê飬ºÃºÃÕûÀíһϣ¬ºÍ´ó¼Ò¹²Ïí¡£
C++I/O
C++Ö§³ÖÁ½ÖÖI/O£¬µÚÒ»ÖÖÊÇ´ÓCÓïÑԼ̳ÐÀ´µÄ£¬Ò»ÖÖÊÇÓÉC++¶¨ÒåµÄÃæÏò¶ÔÏóI/Oϵͳ¡£
1¡¢int getchar(void);·µ»ØÒ»¸öÕûÊýÖµ£¬Ò²¿ÉÒÔÖ¸¶¨Õâ¸öֵΪchar±äÁ¿£¬ÒòΪÕâ¸ö×Ö·û°üº¬ÓÚµÍλ×Ö½ÚÖÐ(¸ßλ×Ö½Úͨ³£Îª0)£¬Èç¹ûÓÐ´í£¬getchar()·µ»ØEOF¡£µ«ÊÇËûÓÐÒ»¸öDZÔÚµÄÎÊÌ⣬Õý³£Çé¿öÏ£¬getchar()»º´æÊäÈ룬ֱµ½¼üÈëÁ˻سµ¼ü(Õâ¸ö´ó¼ÒÓ¦¸ÃÉîÓÐÌå»á£¬¾ÍÊÇgetchar()òËÆÖ»ÈÏʶ»Ø³µ¼ü£¬ÔÀ´ÊÇÕâ¸öÔÒò)Õâ³ÆΪÐлº³åÊäÈ룬ÔÚ¼üÈëµÄ×Ö·ûʵ¼Ê´«Ë͸ø³ÌÐò֮ǰ±ØÐëÇÃÈëÒ»¸ö»Ø³µ¼ü¡£
2¡¢int putchar(int c);
ËäÈ»putchar()´øÒ»¸öÕûÊý²ÎÊý£¬Í¨³£¿ÉÒÔÓÃÒ»¸ö×Ö·ûµÄ±äÔªµ÷ÓÃËü£¬µ«ÊÇÖ»ÓÐÆäµÍλ×Ö½Ú±»Êµ¼ÊÊä³öµ½ÆÁÄ»ÉÏ£¬putchar()º¯Êý·Å»Ø±»Ð´ÈëµÄ×Ö·û£¬Èô²Ù×÷ʧ°Ü£¬·µ»ØEOF(ºêEOF±»¶¨ÒåÓÚstdio.hÖУ¬Í¨³£ÆäֵΪ-1)¡£
3¡¢int getch(void);
int getche(void);
Á½¸ö×î³£ÓõĽ»»¥Ê½º¯Êý£¬¶ÔÓÚ´ó¶àÊý±àÒëÆ÷£¬ÕâЩº¯ÊýµÄÔÐͶ¼¿ÉÔÚÍ·Îļþconio.hÖÐÕÒµ½£¬¶ÔÓÚijЩ±àÒëÆ÷ÖÐÕâЩº¯ÊýÇ°ÃæÓÐһϻ®Ïß¡£Èç_getch()ºÍ_getche();Õâ¾ÍÊÇΪʲôÔÚVS2008Öо³£ÌáʾҪÔÚÇ°Ãæ¼ÓÒ»¸ö'_'.
4¡¢char* gets(char* str);
¶ÁÈ¡´Ó¼üÅÌÉÏÊäÈëµÄ×Ö·û´®²¢°ÑËü´æ·ÅÔÚÓÉÆäËû±äÔªËùÖ¸µÄµØÖ·ÖУ¬Ëü´Ó¼üÅ̶ÁÈë×Ö·û£¬Ö±µ½Óöµ½»Ø³µ¼üΪֹ¡£»Ø³µ¼ü²»ÊäÈë´®µÄÒ»²¿·Ö£¬Ïà·´£¬½«¿Õ½áÊø·û·ÅÔÚ´®Î²À´´úÌ棬²¢ÇÒÓÉgets()·µ»Ø¡£µ«ÊÇʹÓÃgets()ÊÇҪСÐÄ£¬ÒòΪËü²»¶ÔÕýÔÚ½ÓÊÜÊäÈëµÄ×Ö·ûÊý×éÖ´Ðб߽ç¼ì²é¡£Òò´Ë£¬Óû§¿ÉÒÔ¼üÈë±ÈÊý×éÄܹ»ÈÝÄɵĸü¶àµÄ×Ö·û¡£¾¡¹Ü¶ÔÓÚÄãʹÓõķ¶Àý³ÌÐòºÍ¼òµ¥Ê¹Óù¤¾ßÊǺܺõģ¬ÔÚÉÌÓôúÂëÖÐÒ»°ã²»ÊÇÓÃËü¡£ËüµÄµÄÌæ´úÎïÊÇfgets();ÉÔºóÃèÊö¡£
5¡¢int puts(const char* str);
½«ËüµÄ×Ö·û´®±äԪдµ½ÆÁÄ»ÉÏ£¬ºó¸úÒ»ÐÂÐС£ËüµÄµ÷ÓñÈprintf()£»¿ªÏúС£¬ÒòΪputs()Ö»ÄÜÊäÈë×Ö·û´®£¬²»ÄÜÊä³öÊý×Ö»ò½øÐиñʽת»»£¬Òò¶øputs()ÓõĿռäÉÙÇÒËٶȱÈprintf()¿ì¡£Òò´Ëº¯Êýputs()¾³£ÓÃÓÚ´úÂëÓÅ»¯£¬²Ù×÷ʧ°Ü£¬º¯Êýputs()·µ»ØEOF£¬·ñÔò·µ»Ø·Ç¸ºÖµ¡£
6¡¢int printf(const char* control_string,...);
printf()º¯Êý·µ»ØдÈë×Ö·ûµÄÊýÄ¿£¬Èç¹û³öÏÖÒ»¸ö´íÎó£¬Ôò·µ»Øcontrol_string(¿ØÖÆ´®)ÓÐÁ½ÖÖÀàÐÍÏîÄ¿×é³É¡£µÚÒ»ÀàÓɽ«´òÓ¡ÔÚÆÁÄ»ÉϵÄ×Ö·û´®×é³É£¬µÚ¶þÀà°üÀ¨×Ô¶¨ÒåÆäºó±äÔªÏÔʾ·½Ê½µÄ¸ñʽÏÞ¶¨·û¡£¸ñʽÏÞ¶¨·ûÒÔÒ»¸ö°Ù·ÖºÅ¿ªÍ·£¬ºó¸ú¸ñʽ»¯Â룬±
Ïà¹ØÎĵµ£º
Authentication
Login with:New JS-Kit account
Google Friend Connect
Twitter account
FriendFeed account
Yahoo account
Blogspot URL
JS-Kit account
Haloscan account
OpenID
Dear visitor,
Thanks for your interest in C programming.
In this page, you will find a
list of interesting C p ......
CÓïÑÔÖ®ËùÒÔÒªÆðÃûΪ“C”£¬ÊÇÒòΪËüÊÇÖ÷Òª²Î¿¼ÄǸöʱºòµÄһÎÐBµÄÓïÑÔ£¬ËüµÄÉè¼ÆÕßÈÏΪCÓïÑÔÊÇBÓïÑԵĽø²½£¬ËùÒÔ¾ÍÆðÃûΪCÓïÑÔ£»µ«ÊÇBÓïÑÔ²¢²»ÊÇÒòΪ֮ǰ»¹ÓиöAÓïÑÔ£¬¶øÊÇBÓïÑÔµÄ×÷ÕßΪÁ˼ÍÄîËûµÄÆÞ×Ó£¬ËûµÄÆÞ×ӵĵÚÒ»¸ö×ÖĸÊÇB£»
µ±CÓïÑÔ·¢Õ¹µ½¶¥·åµÄʱ¿Ì£¬³öÏÖÁËÒ»¸ö°æ±¾½ÐC with ......
Õâ¸ö±¾À´ÒÔǰҲд¹ýµÄ£¬½ñÌìÎÞÁĸ´Ï°Ï ÔÙдһ±é¡£¼òµ¥µÄÒ»ËúºýÍ¿£¬Ð´µÄ²»Õ¦µØ´ó¼Ò¼ûÁÂŶ£¡ÓпÕÔÙ¼ÓÇ¿ ºÙºÙ£¡
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <time.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h ......
ÔÎĵØÖ·£ºhttp://www.henryxu.com/post/1.html
C++µÄ¸ñʽ»¯×Ö·û´®¾³£ÓÃ×÷¸ñʽ»¯Êý×ÖµÄÊä³ö¡¢×Ö·û´®ºÏ²¢ºÍת»»µÈµÈºÜ¶à³¡ºÏ¡£
1. ¸ñʽ»¯¹æ¶¨·û
©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥
·ûºÅ &nbs ......