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

linux C ¶ÁȡĿ¼Îļþ²¢Í³¼ÆÎļþÊý

#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#define MAX 1024
int get_file_count(char *root)
{
 DIR *dir;
 struct dirent * ptr;
 int total = 0;
 char path[MAX];
 dir = opendir(root); /* ´ò¿ªÄ¿Â¼*/
 if(dir == NULL)
 {
  perror("fail to open dir");
  exit(1);
 }
 errno = 0;
 while((ptr = readdir(dir)) != NULL)
 {
  //˳Ðò¶Áȡÿһ¸öĿ¼Ï
  //Ìø¹ý“..”ºÍ“.”Á½¸öĿ¼
  if(strcmp(ptr->d_name,".") == 0 || strcmp(ptr->d_name,"..") == 0)
  {
   continue;
  }
  //printf("%s%s\n",root,ptr->d_name);
  //Èç¹ûÊÇĿ¼£¬ÔòµÝ¹éµ÷Óà get_file_countº¯Êý
  
  if(ptr->d_type == DT_DIR)
  {
   sprintf(path,"%s%s/",root,ptr->d_name);
   //printf("%s\n",path);
   total += get_file_count(path);
  }
  
  if(ptr->d_type == DT_REG)
  {
   total++;
   printf("%s%s\n",root,ptr->d_name);
  }
 }
 if(errno != 0)
 {
  printf("fail to read dir");  //ʧ°ÜÔòÊä³öÌáʾÐÅÏ¢
  exit(1);
 }
 closedir(dir);
 return total;
}
int main(int argc, char * argv[])
{
 int total;
 if(argc != 2)
 {
  printf("wrong usage\n");
  exit(1);
 }
 total = get_file_count(argv[1]);
 printf("%s ha %d files\n",argv[1],total);
 return 0;
}


Ïà¹ØÎĵµ£º

Linux ÄÚºËÆô¶¯·ÖÎö£¨×ª£©

Linux ÄÚºËÆô¶¯·ÖÎö£¨×ª£©
Linux ÄÚºËÆô¶¯·ÖÎö
1.       ÄÚºËÆô¶¯µØÖ·
1.1.   Ãû´Ê½âÊÍ
ZTEXTADDR
½âѹ´úÂëÔËÐеĿªÊ¼µØÖ·¡£Ã»ÓÐÎïÀíµØÖ·ºÍÐéÄâµØÖ·Ö®·Ö£¬ÒòΪ´ËʱMMU´¦ÓڹرÕ״̬¡£Õâ¸öµØÖ·²»Ò»¶¨Ê±RAMµÄµØÖ·£¬¿ÉÒÔÊÇÖ§³Ö¶ÁдѰַµÄflashµÈ´æ´¢Öн顣
Start address of ......

linuxÔ¶³Ì¸´ÖÆ linuxÔ¶³Ì¿½±´

linuxÔ¶³Ì¸´ÖÆ linuxÔ¶³Ì¿½±´
Ô¶³ÌÉÏ´«Îļþ¼Ð
¾ÙÀý£¬
ÎÒÒª½«±¾µØÎļþ¼Ð/home/administrator/Desktop/old/driver/test/
Ô¶³ÌÉÏ´«µ½ 192.168.62.10 Õą̂»úÆ÷µÄ/root/Îļþ¼ÐÏ£¬Ê¹ÓÃÔ¶³Ì¶ËµÄrootÓû§×÷ΪµÇ½Óû§
scp -r /home/administrator/Desktop/old/driver/test/ root@192.168.62.10:/root/
Ô¶³ÌÉÏ´«Îļþ¼Ð
¾ÙÀ ......

linux϶àÏß³Ì Ö® pthread_detach(pthread_self())

ÕýʽʵϰһÖÜ£¬Óеã¸Ð´¥¡£±¾À´¾ÍûָÍûÄܳÉΪʲô¼¼Êõ´óÅ££¬ÓÃ×Ô¼ºµ÷Ù©µÄ»°À´Ëµ¾ÍÊÇ“»ì¿Ú·¹³Ô”¡£²»¹ýÀÏ´ó¶ÔmeµÄÆÚÍûÖµÄÇô¸ß£¬¾­Àí¹ÜµÃÕâôÑÏ£¬Ñ¹Á¦ÆÄ´ó¡£¶Ô×Ô¼ºÍ¦Ê§Íû£¬Ã»ÄÜ¿ªºÃÍ·£¬Óеã¶Ô²»ÆðÕâô³É¹¦µÄÀÏ´ó¡£»¹ºÃû׼±¸×öʲô´óÊ£¬Òª²»È»ÕâÐÔ¸ñµÃ·Ñ¶à´óÁ¦Æø²ÅÄÜÖØËÜ¡£¡£¡£
¶¼ÊDZƳöÀ´µÄ£¬±»¾­Àíѵºó£¬Ò»Ìì ......

firefox ¼òµ¥ ²å¼þ±àÒë ¡¾linux¡¿

#ifdef XP_UNIX
/*
* Set up the plugin function table that Netscape will use to
* call us. Netscape needs to know about our version and size
* and have a UniversalProcPointer for every function we
* implement.
*/
pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ