C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(12)
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. ldexpº¯Êý
ldexpº¯ÊýµÄ¹¦ÄÜÊǼÆËãvalue*2µÄÃÝ£¬ÆäÓ÷¨Îª£ºdouble ldexp(double value, int exp);³ÌÐòʵÀýÈçÏ£º
#include <stdio.h>
#include <math.h>
int main(void)
{
double value;
double x = 2;
value = ldexp(x,3);
printf("The ldexp value is: %lf\n",value);
return 0;
}
2. 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;
}
3. lockº¯Êý
lockº¯ÊýµÄ¹¦ÄÜÊÇÉèÖÃÎļþ¹²ÏíËø£¬ÆäÓ÷¨Îª£ºint lock(int handle, long offset, long length);³ÌÐòʵÀý´úÂëÈçÏ£º
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#include <process.h>
#include <share.h>
#include <stdio.h>
int main(void)
{
int handle, status;
long length;
handle = sopen("c:\\autoexec.bat",
O_RDONLY,SH_DENYNO,S_IREAD);
if (ha
Ïà¹ØÎĵµ£º
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. fgetcº¯Êý
fgetcº¯ÊýµÄ¹¦ÄÜÊÇ´ÓÁ÷ÖжÁÈ¡×Ö·û£¬ÆäÓ÷¨ÊÇ£ºint fgetc(FILE *stream); ³ÌÐòÀý×ÓÈçÏ£º
#include <string.h ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. initgraphº¯Êý
initgraphº¯ÊýÊdzõʼ»¯Í¼ÐÎϵͳ£¬ÆäÓ÷¨Îª£ºvoid far initgraph(int far *graphdriver, int far *graphmode,char far *pathtodriver); ³ÌÐòÀý×ÓÈçÏ£ ......
ÈÕÆÚ£º2009-11-21 10:54:22
±¾½ÚÖ÷Òª²Î¿¼£º
²ÜÀֵġ¶ÔÚEmacsÏÂÓÃC/C++±à³Ì¡·
Íõ´¿ÒµµÄ¡¶Emacs Ò»¸öÇ¿´óµÄƽ̨¡·
emacswiki.org
emcasÄÑѧÒ×Ó㬿ÉÀ©Õ¹ÐÔÇ¿¡£ÓÐÈË°ÑËýµ±×÷ÐÅÑö£¬ÓÐÈËÈÏΪËûÊÇħ¹í£¡Ñ§Ï°Ê×ÏȼÇס»ù±¾µÄ¼üÅÌ¿ì½Ý¼ü£¬Ñ§»á³£Óòå¼þ£¬ ......
µÚÒ»ÖÖÀí½â
±ÈÈç˵ÄãÓÃC++¿ª·¢ÁËÒ»¸öDLL¿â£¬ÎªÁËÄܹ»ÈÃCÓïÑÔÒ²Äܹ»µ÷ÓÃÄãµÄDLLÊä³ö(Export)µÄº¯Êý£¬ÄãÐèÒªÓÃextern "C"À´Ç¿ÖƱàÒëÆ÷²»ÒªÐÞ¸ÄÄãµÄ
º¯ÊýÃû¡£
ͨ³££¬ÔÚCÓïÑÔµÄÍ·ÎļþÖо³£¿ÉÒÔ¿´µ½ÀàËÆÏÂÃæÕâÖÖÐÎʽµÄ´úÂ룺
#ifdef __cplusplus
extern "C" {
#endif
/**** some declaration or so *****/
#ifde ......
5¡¢#defineºê¶¨Òå¡£ºêÖ»ÊǼòµ¥µÄÎı¾Ìæ»»£¬ºÜÈÝÒ×ÒýÆðÆçÒå¡£
#include <stdio.h>
#define CONS(a,b) (int)(a##e##b)
#define STR(s) #s
int main()
{
printf(STR(vck));
printf("\n");
printf("%d\n",CONS(2,3));
return 0; ......