ÓÃCдµÄ¶ÁÈ¡´úÂëÐÐÊý¡£
½ñÌìÎÞÊ£¬ÔÚÂÛ̳ÉÏÒ»Ö±¿´Ìù×Ó£¬ºÜÉÙ¶¯ÊÖʵ¼ù£¬½ñÌìÊÔ×ÅдÁËÒ»¸ö¶ÁÈ¡Ô´³ÌÐò´úÂëÐÐÊýµÄÀý×Ó£º
ÏÖÔڵĴúÂëÈçÏ£¬¿ÉÄÜ»¹Óв»ÍêÉƵĵط½£¬ÒÔºóÔٸĽø£º
#include <stdio.h>
#define CHARCOUNT 255
#define CON 6 /*µ¥ÐÐ×¢ÊÍ×îÉÙµÄʱºò*/
int realLength = 0;
/*
* function name: strCount
* function : count line number
* created by : lsl
*/
int strCount(int from, char * str)
{
int length = strlen(str), i = 0;
int realCount = length-2-from;
for(i = length-3; str[i]==' ' || str[i] ==' '; i--)
{
realCount--;
}
realLength = realCount;
return realLength;
}
int main(int argc, char *argv[])
{
FILE *fPtr = fopen("tt.c","r");
char buffer[CHARCOUNT];
int lineCount = 0,i=0,j=0,k=0,bufferLen = 0;
int moutLineComment = 0;
if(NULL == fPtr)
{
printf("file open error!\n");
exit(0);
}
while(NULL != fgets(buffer,CHARCOUNT,fPtr))
{
//Èç¹ûÖ»°üº¬Ò»Éϻسµ begin
if(13 == buffer[0] && 10 == buffer[1])
{
//printf("%x%x\n",buffer[0],buffer[1]);
continue;
}
//Èç¹ûÖ»°üº¬Ò»¸ö»Ø³µ end
else
{
bufferLen = strlen(buffer);//¶ÁÈëÐеij¤¶È ËãÉ϶ÁÈëĩβµÄ \n\r
//ÅжÏÒ»ÐÐΪ¿ÕÐеÄÇé¿ö ´ËÐпÉÄÜ°üº¬Ðí¶à¿Õ¸ñ tab begin
for(i = 0; 32 == buffer[i] || 9 == buffer[i] || 13 == buffer[i] || 10 == buffer[i]; i++ )
{
if(i == bufferLen)
{
break;
}
}
if(bufferLen == i)
{
continue;
}
//ÅжÏÒ»ÐÐΪ¿ÕÐеÄÇé¿ö end
//ÅжÏ//×¢ÊÍ begin
else if(buffer[i] == '/' && buffer[i+1] == '/')
{
continue;
}
//ÅжÏ//×¢ÊÍ end
//Åж϶àÐÐ×¢ÊÍ begin
else if(buffer[i] == '/' && buffer[i+1] == '*')
{
//**/rin tf("here\n");
if((bufferLen-i)>=CON)
{
int tmpLen = strCount(i,buffer);//Çó³ö´ËÐдÓi¿ªÊ¼³ý×îºóµÄ¿Õ¸ñ¡¢\r\nÖ®ÍâµÄ×Ö·ûÊý
if((tmpLen>=4) && buffer[i+tmpLen-2] == '*' && buffer[i+tmpLen-1] == '/')
{
continue;
}
else
{
Ïà¹ØÎĵµ£º
ÄÚÈÝ£ºMemory
1. ¼¸¸ö»ù±¾¸ÅÄpage¡¢frame¡¢paging¡¢segment¡£
½ø³Ì·ÖÅäÄÚ´æµÄÁ½ÖÖģʽ£¬Ò»¸öʹÓà exec ϵÁк¯Êý£¬Ò»¸öʹÓà programmatically£¨malloc µÈº¯Êý£©¡£
ÖØÒªµÄ segment ÓÐ text segment£¨´æ·Å´úÂëµÈµÈ£¬Ò»°ãÔÚ½ø³ÌµÄÉúÃüÖÜÆÚÖв»±ä£©¡¢data segment
£¨´æ·ÅÊý¾Ý£¬ÄÜÓÃһЩº¯ÊýÀ´µ÷Õû´óС£¬²»¹ýµÍλ¶ËλÖò»± ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. fcloseº¯Êý
fcloseº¯ÊýµÄ¹¦ÄÜÊǹرÕÒ»¸öÁ÷£¬ÆäÓ÷¨ÊÇ£ºint fclose(FILE *stream); ³ÌÐòÀý×ÓÈçÏ£º
#include <string.h& ......
Ç°ÑÔ
Eclipse×÷Ϊһ¿î¼«ÆäÓÅÐãµÄJava IDE£¬ÒѾµÃµ½¹ã·ºµÄÈÏ¿É¡£µ±È»Eclipse²¢²»ÏÞÓÚJava¿ª·¢£¬ÓÉÓÚÆäÓÅÐãµÄ»ù´¡¼Ü¹¹£¬EclipseÒѾ³ÉΪһ¸ö¿ÉÒÔÈÝÄÉÒ»ÇÐÓ뿪·¢ÓйصŤ¾ßµÄƽ̨¡£
µ±È»ÈÝÄÉÒ»Çв¢²»Òâζ×ÅÊʺÏÓÚÒ»ÇС£ÏñC/C++ÕâÑùÔç¾Í´æÔڵIJ¢¹ã·ºÓ¦ÓõÄÓïÑÔ£¬Ôç¾ÍÓÐÒ»´óÅú¿ÉÓõÄIDE£¬Ò²ÓкܶàÈËϲ»¶ÓÃvi/emacs×÷Ϊ×Ô¼ºµÄ¿ ......
µÚÒ»ÖÖÀí½â
±ÈÈç˵ÄãÓÃ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; ......