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

C/C++ ÅжÏ·¾¶ÎªÎļþ

/***************************************************
* º¯Êý˵Ã÷: Åжϵ±Ç°path²ÎÊýÊÇ·ñΪһ¸ö¿É¶ÁµÄÎļþ
* º¯Êý·µ»Ø: 0 - Îļþ¿Ì¶È 1 - ȨÏ޾ܾø -1 -º¯Êý´íÎó
*   ²Î Êý : path Îļþ·¾¶.
***************************************************/
int isReadFile(const char *path)
{
        struct stat info;
        int euid,egid;
        if ( 0!= stat(path,&info) )
        {
                return -1;
        }
        //if it is a file
        if( S_IFREG != (info.st_mode & S_IFMT ) )
        {
                return 1;
        }
        euid=geteuid();//returns the real user ID of the
current process
        egid=getegid();//returns the effective user ID of the
current process
        //if effective user is root
        if(euid==0)
        {
                if(info.st_mode & S_IRUSR || info.st_mode &
S_IRGRP ||info.st_mode & S_IROTH)
                {
                        return 0;
                }
         


Ïà¹ØÎĵµ£º

ÓÃCдµÄ3DÃÔ¹¬

          Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
       ´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸е쬻î»î»î£¡
         &n ......

C/C++»ù´¡ÎÊÌâÕûÀí

ÕâÆªÎÄÕÂÖмǼ±¾È˶ÔһЩC/C++»ù´¡¸ÅÄîµÄÀí½â£¬Ö÷Òª°üÀ¨ÒÔϼ¸¸ö·½ÃæÄÚÈÝ£º
1¡¢ÀàÐÍת»»
1¡¢ÀàÐÍת»»
ÔÚCºÍC++µÄÒ»¸ö±í´ïʽÖÐÍùÍù»á°üº¬¼¸ÖÖ²»Í¬µÄÊý¾ÝÀàÐÍ£¬ÒªÈÃÕâЩÊý¾ÝÀàÐÍÖ®¼ä¿ÉÒÔ½øÐÐÔËË㣬±ØÐëÈÃËûÃÇÖ®ÖеÄһЩ»òÈ«²¿½øÐÐÀàÐÍת»»£¬ÕâÖÖת»»ÓÐÁ½ÖÖÐÎʽ£¬Ò»ÖÖÊDZàÒëÆ÷×Ô¶¯½øÐе쬽ÐÒþʽÀàÐÍת»»£¬ÁíÒ»ÖÖÊDZà³ÌÖÐÇ ......

C/C++±ÊÊÔ¡¢ÃæÊÔÌâÄ¿»ã×Ü

1.ÇóÏÂÃæº¯ÊýµÄ·µ»ØÖµ£¨Î¢Èí£©
int func(x)
{
int countx = 0;
while(x)
{
countx ++;
x = x&(x-1);
}
return countx;
}
¼Ù¶¨x = 9999¡£ ´ð°¸£º8
˼·£º½«xת»¯Îª2½øÖÆ£¬¿´º¬ÓеÄ1µÄ¸öÊý¡£
2. ʲôÊÇ“ÒýÓÔ£¿ÉêÃ÷ºÍʹÓÓÒýÓÔҪעÒâÄÄЩÎÊÌ⣿
´ð£ºÒýÓþÍÊÇij¸öÄ¿±ê±äÁ¿µÄ&ldquo ......

C/C++ DIR±éÀúº¯Êý

#include <list.h>
#include <dirent.h>
#include <iostream.h>
#include <sys/stat.h>
#include <sys/types.h>
/*****************************************************************
*º¯Êý¹¦ÄÜ: Ä¿_¼_±é_Àú.
*·µ»ØÖµ:   ³É¹¦·µ»Ø0,ʧ°Ü·µ»Ø·Ç0.
*²ÎÊý   path ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ