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

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

C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
 
1. kbhitº¯Êý
 
kbhitº¯ÊýÊǼì²éµ±Ç°°´Ïµļü£¬ÆäÓ÷¨Îª£ºint kbhit(void);³ÌÐòÀý×ÓÈçÏ£º
#include <conio.h>
int main(void)
{
   cprintf("Press any key to continue:");
   while (!kbhit()) /* do nothing */ ;
   cprintf("\r\nA key was pressed...\r\n");
   return 0;
}
2. keepº¯Êý
 
keepº¯ÊýÊÇÍ˳ö²¢¼ÌÐøפÁô£¬ÆäÓ÷¨Îª£ºvoid keep(int status, int size);³ÌÐòÀý×ÓÈçÏ£º
#include <dos.h>
#define INTR 0x1C
#define ATTR 0x7900
extern unsigned _heaplen = 1024;
extern unsigned _stklen  = 512;
void interrupt ( *oldhandler)(void);
void interrupt handler(void)
{
   unsigned int (far *screen)[80];
   static int count;
   screen = MK_FP(0xB800,0);
   count++;
   count %= 10;
   screen[0][79] = count + '0' + ATTR;
   oldhandler();
}
int main(void)
{
oldhandler = getvect(INTR);
setvect(INTR, handler);
keep(0, (_SS + (_SP/16) - _psp));
return 0;
}
3. lfindº¯Êý
Lfindº¯ÊýÊÇÖ´ÐÐÏßÐÔËÑË÷£¬ÆäÓ÷¨Îª£ºvoid *lfind(void *key, void *base, int *nelem, int width, int (*fcmp)()); ³ÌÐòÀý×ÓÈçÏ£º
#include <stdio.h>
#include <stdlib.h>
int compare(int *x, int *y)
{
   return( *x - *y );
}
int main(void)
{
   int array[5] = {35, 87, 46, 99, 12};
   size_t nelem = 5;
   int key;
   int *result;
   key = 99;
   result = lfind(&key, array, &nelem,
        sizeof(int), (int(*)(const void *,const void *))compare);
   if (result)
      printf("Number %d found\n",key);
   else
      printf("Number %d not found\n",key);
   return 0;
}


Ïà¹ØÎĵµ£º

¹ØÓÚcÖÐvolatile¹Ø¼ü×Ö£¨×ªÌù£©

 Ò»¸ö¶¨ÒåΪvolatileµÄ±äÁ¿ÊÇ˵Õâ±äÁ¿¿ÉÄܻᱻÒâÏë²»µ½µØ¸Ä±ä£¬ÕâÑù£¬±àÒëÆ÷¾Í²»»áÈ¥¼ÙÉèÕâ¸ö±äÁ¿µÄÖµÁË¡£¾«È·µØ˵¾ÍÊÇ£¬ÓÅ»¯Æ÷ÔÚÓõ½Õâ¸ö±äÁ¿Ê±±ØÐëÿ´Î¶¼Ð¡ÐĵØÖØжÁÈ¡Õâ¸ö±äÁ¿µÄÖµ£¬¶ø²»ÊÇʹÓñ£´æÔڼĴæÆ÷ÀïµÄ±¸·Ý¡£ÏÂÃæÊÇvolatile±äÁ¿µÄ¼¸¸öÀý×Ó£º
    1). ²¢ÐÐÉ豸µÄÓ²¼þ¼Ä´æÆ÷£¨È磺״̬¼Ä´æÆ ......

C/C++ÎÊ´ð(3)£º¹ØÓÚ¹¹ÔìºÍÎö¹¹º¯ÊýʹÓöà̬

ÎÊ£º
ÔÚ¹¹Ôì»òÎö¹¹ÆÚ¼äÄÜʹÓÃÐ麯ÊýÂð£¿
´ð£º
ÄÜ£¬µ«×îºÃ²»ÒªÕâô×ö¡£
Ç°Á½ÌìÔÚ¹«Ë¾ÓÎÏ·ÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÔÚÎö¹¹º¯ÊýÖв»Ð¡Ðĵ÷ÓÃÁËÐ麯Êý£¬¶øÇÒ»¹ÊǸö´¿Ð麯Êý¡£
ÒòΪһֱÊÇÔÚRleaseģʽϹ¤×÷µÄ£¬µ¼ÖÂϵͳֱ½ÓÖÕÖ¹¿Í»§¶Ë£¬ËäÈ»¿ØÖÆ̨ÓдòÓ¡Õâ¸ö´íÎ󣬵«ÖÕֹ̫¿ì£¬Ò²Ã»¿´µ½¡£Çл»ÔÚDebugϵ÷ÊÔ£¬Ôò»á±¨R6025 -pure vir ......

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

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

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

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