C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(6)
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. fcloseº¯Êý
fcloseº¯ÊýµÄ¹¦ÄÜÊǹرÕÒ»¸öÁ÷£¬ÆäÓ÷¨ÊÇ£ºint fclose(FILE *stream); ³ÌÐòÀý×ÓÈçÏ£º
#include <string.h>
#include <stdio.h>
int main(void)
{
FILE *fp;
char buf[11] = "0123456789";
/* create a file containing 10 bytes */
fp = fopen("DUMMY.FIL", "w");
fwrite(&buf, strlen(buf), 1, fp);
/* close the file */
fclose(fp);
return 0;
}
2. fcloseallº¯Êý
fcloseallº¯ÊýµÄ¹¦ÄÜÊǹرմò¿ªÁ÷£¬ÆäÓ÷¨ÊÇ£ºint fcloseall(void); ³ÌÐòÀý×ÓÈçÏ£º
#include <stdio.h>
int main(void)
{
int streams_closed;
/* open two streams */
fopen("DUMMY.ONE", "w");
fopen("DUMMY.TWO", "w");
/* close the open streams */
streams_closed = fcloseall();
if (streams_closed == EOF)
/* issue an error message */
perror("Error");
else
/* print result of fcloseall() function */
printf("%d streams were closed.\n", streams_closed);
return 0;
}
3. fcvtº¯Êý
fcvtº¯ÊýµÄ¹¦ÄÜÊÇ°ÑÒ»¸ö¸¡µãÊýת»»Îª×Ö·û´®£¬ÆäÓ÷¨ÊÇ£ºchar *fcvt(double value, int ndigit, int *decpt, int *sign); ³ÌÐòÀý×ÓÈçÏ£º
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
char *string;
double value;
int dec, sign;
int ndig = 10;
clrscr();
value = 9.876;
string = ecvt(value, ndig, &dec, &sign);
printf("string = %s
Ïà¹ØÎĵµ£º
Ô¤´¦ÀíÆ÷£¨Preprocessor£©
1. ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365)UL
ÎÒÔÚÕâÏë¿´µ½¼¸¼þÊÂÇ飺
1). #define Óï·¨µÄ»ù±¾ÖªÊ¶£¨ÀýÈ磺²»ÄÜÒԷֺŽáÊø£¬À¨ºÅµÄʹÓ㬵ȵȣ©
2). ¶®µÃÔ¤´¦ÀíÆ÷½«ÎªÄã¼ÆËã³£Êý±í´ïʽµÄÖµ£¬Òò´Ë£¬Ö±½Ó ......
×î½üÒ»¸öÏîÄ¿ÓÃlua5.1.4ºÍc++ÁªºÏ¿ª·¢¡£ÔÚ¿ª·¢µÄ¿ªÊ¼½×¶ÎÓöµ½ÁËÒ»µãÎÊÌ⣬ÎÊÌâÈçÏ£º
ÓÃÃüÁîÐÐÔËÐУºlua test.lua
lua: error loading modules 'dllforlua' from file './dllforlua.dll':
ÕÒ²»µ½Ö¸¶¨µÄ³ÌÐò¡£
ÒòΪÊǵÚÒ»´ÎʹÓã¬Õâ¸öÎÊÌâÀ§ÈÅÁËÎҺü¸Ìì¡£¾¹ý¶à·¬²âÊÔ£¬·¢ÏÖÈçϹæÂÉ£º
Èç¹ûÓ ......
ÔÚNotes µÄC/S ±à³ÌÖУ¬¾³£ÐèÒª¶ÔÒ»¸ö¼¯ºÏÖеĶÔÏó½øÐбéÀú´¦Àí£¬ÕâʱÈç¹ûÄÜÏÔʾһ¸ö½ø¶ÈÌõָʾµ±Ç°´¦Àí½ø³Ì£¬¾Í±È½ÏÖ±¹ÛÐÎÏ󣬿ͻ§½çÃæÒ²±È½ÏÓѺá£
1¡¢ÉùÃ÷APIº¯Êý
'ÉùÃ÷APIº¯Êý
Declare Function NEMProgressBegin Lib&nbs ......
ʱ³£ÔÚcppµÄ´úÂëÖ®Öп´µ½ÕâÑùµÄ´úÂë:
#ifdef __cplusplus
extern "C" {
#endif
//Ò»¶Î´úÂë
#ifdef __cplusplus
}
#endif
¡¡¡¡ÕâÑùµÄ´úÂëµ½µ×ÊÇʲôÒâ˼ÄØ£¿Ê×ÏÈ£¬__cplusplusÊÇcppÖеÄ×Ô¶¨Òåºê£¬ÄÇô¶¨ÒåÁËÕâ¸öºêµÄ»°±íʾÕâÊÇÒ ......