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;
}
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃæ£¬ºóÃæ ......
yeah£¬×éºÏµÄÒ²³öÀ´ÁË£¬ÔÙÒ»Æð·¢Ò»¸ö
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication32
{
class Program
{
static int s = 0;
static void Main(string[] args)
{
Console.Writ ......
CRT (C run-time library)
Ò» ²úÉú
ÔËÐÐʱ¿âÊdzÌÐòÔÚÔËÐÐʱËùÐèÒªµÄ¿âÎļþ£¬Í¨³£ÒÔLIB»òDLLÐÎʽÌṩ¡£
CÔËÐÐʱ¿â¾ÍÊÇC run-time library£¬µ®ÉúÓÚ20ÊÀ¼Í70Äê´ú£¬ÊÇC¶ø·ÇC++ÓïÑÔÊÀ½çµÄ¸ÅÄC³ÌÐòÔËÐÐʱÐèÒªÕâЩ¿âÖеĺ¯Êý¡£
C ÓïÑÔÊÇËùνµÄ“СÄں˔ÓïÑÔ£¬¾ÍÆäÓïÑÔ±¾ÉíÀ´ËµºÜС£¨²»¶àµÄ¹Ø¼ü×Ö£¬³ÌÐòÁ÷³Ì¿ØÖÆ£ ......
ÔÚWindows 2000/XPÖУ¬"Documents and Settings"ÊÇÒ»¸öÌØÊâÎļþ¼Ð¡£Óû§ÅäÖÃÎļþ¡¢×ÀÃæ¡£ÉõÖÁÁ¬ÃÜÔ¿ÐÅÏ¢¶¼±£´æÔÚÕâÀïÃæ¡£Èç¹ûÓ²Å̿ռ䲻¹»£¬Ïë°ÑËüÃÇ»»¸öµØ·½¡£µ«ÕâЩ¶«Î÷È´ºÜÄÑÒÆ¶¯¡£ÎÒÃǵÄÎÊÌâÊÇ£ºÈçºÎÔÚ±£Ö¤ÏµÍ³Õý³£ÔËÐеÄÇé¿öÏ£¬½«"Documents and Settings"Îļþ¼ÐÒÆ¶¯µ½ÁíÍâÒ»¸ö·ÖÇø?
......
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
/****************************************************
* º¯Êý¹¦ÄÜ: ÅжϲÎÊý·¾¶ÊÇ·ñΪ(ÕýÈ·µÄ)Ŀ¼
* º¯Êý·µ»Ø: 0Ϊ±íʾ·¾¶ÎªÎļþ,1Ϊ·ÇĿ¼.ÆäËûΪ´íÎó
* ²ÎÊý: pathÎļþÐèÒªÅжϵÄĿ¼µÄ·¾¶.
*  ......