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

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

C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
 
1.       gcvtº¯Êý
 
gcvtº¯ÊýµÄ¹¦ÄÜÊǰѸ¡µãÊýת»»³É×Ö·û´®£¬ÆäÓ÷¨ÊÇ£ºchar *gcvt(double value, int ndigit, char *buf);³ÌÐòÀý×ÓÈçÏ£º
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   char str[25];
   double num;
   int sig = 5; /* significant digits */
   /* a regular number */
   num = 9.876;
   gcvt(num, sig, str);
   printf("string = %s\n", str);
   /* a negative number */
   num = -123.4567;
   gcvt(num, sig, str);
   printf("string = %s\n", str);
   /* scientific notation */
   num = 0.678e5;
   gcvt(num, sig, str);
   printf("string = %s\n", str);
   return(0);
}
2.      getcrº¯Êý
 
getcrº¯ÊýµÄ¹¦ÄÜÊÇ´ÓÁ÷ÖÐÈ¡×Ö·û£¬ÆäÓ÷¨ÊÇ£ºint getc(FILE *stream); ³ÌÐòÀý×ÓÈçÏ£º
 
#include <stdio.h>
int main(void)
{
   char ch;
   printf("Input a character:");
/* read a character from the
   standard input stream */
   ch = getc(stdin);
   printf("The character input was: '%c'\n",
          ch);
   return 0;
}
3.      getftimeº¯Êý
 
getftimeº¯ÊýµÄ¹¦ÄÜÊÇÈ¡ÎļþÈÕÆÚºÍʱ¼ä£¬ÆäÓ÷¨ÊÇ£ºint getftime(int handle, struct ftime *ftimep);³ÌÐòÀý×ÓÈçÏ£º
 
#include <stdio.h>
#include <io.h>
int main(void)
{
   FILE *stream;
   struct ftime ft;
   if ((stream = fopen("TEST.$$$",
        "wt")) == NULL)
   {
      fprintf(stderr,
          &nbs


Ïà¹ØÎĵµ£º

C/C++ ³£¼ûÃæÊÔÌâ

 
1.Ö¸ÕëºÍÒýÓÃÓÐʲô·Ö±ð£»Èç¹û´«ÒýÓñȴ«Ö¸Õ밲ȫ£¬ÎªÊ²Ã´£¿Èç¹ûÎÒʹÓó£Á¿Ö¸ÕëÄѵÀ²»ÐÐÂð£¿
     (1) ÒýÓÃÔÚ´´½¨µÄͬʱ±ØÐë³õʼ»¯£¬¼´ÒýÓõ½Ò»¸öÓÐЧµÄ¶ÔÏ󣻶øÖ¸ÕëÔÚ¶¨ÒåµÄʱºò²»±Ø³õʼ»¯£¬¿ÉÒÔÔÚ¶¨ÒåºóÃæµÄÈκεط½ÖØи³Öµ£®
     (2) ²»´æÔڣΣգ̣ÌÒýÓã¬ÒýÓÃ±Ø ......

CºÍC£«£«»ìºÏ±à³ÌÏà¹ØÎÊÌâ½â¾ö·½·¨

Ò» £º½â¾öC»òC++ÖеÄmultiple definition ofÎÊÌâ
server.cpp
clientp2p.cpp
#include "exception.h"
#include "clientp2p.h"
clientp2p.h
ÖÐдÓÐËùÓеÄÈ«¾Ö±äÁ¿¼°Æä³õʼ»¯Öµ
ºÍº¯ÊýÉùÃ÷
1.server.cppÖУº
ÒýÓÃ
£º
#include "clientp2p.h"
int Main(....)
{
...
}
2.clientp ......

c vaϵÁкêµÄ»ù±¾Ó÷¨

 vaϵÁкêµÄÓ÷¨µÄÒ»°ã²½Ö裺
 vsptr(char *format, ...)  //ÇмǴ˴¦µÄ¸ñʽ
 {
    va_list argptr;
    va_start(argptr, format); //ʹµÃargptrÖ¸ÏòÒÔformat¿ªÍ·µÄ´æ´¢¿Õ¼ä
    va_arg(argptr, type);  //È¡´«µÝµÄ²ÎÊý
    ......

GNU C library ±Ê¼Ç£¨2£©

ÄÚÈÝ£ºMemory
1. ¼¸¸ö»ù±¾¸ÅÄpage¡¢frame¡¢paging¡¢segment¡£
½ø³Ì·ÖÅäÄÚ´æµÄÁ½ÖÖģʽ£¬Ò»¸öʹÓà exec ϵÁк¯Êý£¬Ò»¸öʹÓà programmatically£¨malloc µÈº¯Êý£©¡£
ÖØÒªµÄ segment ÓÐ text segment£¨´æ·Å´úÂëµÈµÈ£¬Ò»°ãÔÚ½ø³ÌµÄÉúÃüÖÜÆÚÖв»±ä£©¡¢data segment
£¨´æ·ÅÊý¾Ý£¬ÄÜÓÃһЩº¯ÊýÀ´µ÷Õû´óС£¬²»¹ýµÍλ¶ËλÖò»± ......

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

C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1.       fgetcº¯Êý
fgetcº¯ÊýµÄ¹¦ÄÜÊÇ´ÓÁ÷ÖжÁÈ¡×Ö·û£¬ÆäÓ÷¨ÊÇ£ºint fgetc(FILE *stream); ³ÌÐòÀý×ÓÈçÏ£º
#include <string.h ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ