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;
}
Ïà¹ØÎĵµ£º
¾«¶Ì¸ßЧµÄXML½âÎöÆ÷,´¿Cµ¥Ò»³ÌÐò,Ó¦ÓÃÓÚÒøÐеĹú˰¿âÐкáÏòÁªÍø½Ó¿ÚϵͳÖÐ,Îȶ¨¿É¿¿,ÔËÐÐËÙ¶È·É¿ì,·ÇÏàÓ¦µÄJAVA³ÌÐò¿É±È.ÒÔÏÂΪ´ó²¿·ÖÔ´Âë:
/* Copyright (c) 2005 wzs */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <varargs.h>
#i ......
ÕâÆªÎÄÕÂÖмǼ±¾È˶ÔһЩC/C++»ù´¡¸ÅÄîµÄÀí½â£¬Ö÷Òª°üÀ¨ÒÔϼ¸¸ö·½ÃæÄÚÈÝ£º
1¡¢ÀàÐÍת»»
1¡¢ÀàÐÍת»»
ÔÚCºÍC++µÄÒ»¸ö±í´ïʽÖÐÍùÍù»á°üº¬¼¸ÖÖ²»Í¬µÄÊý¾ÝÀàÐÍ£¬ÒªÈÃÕâЩÊý¾ÝÀàÐÍÖ®¼ä¿ÉÒÔ½øÐÐÔËË㣬±ØÐëÈÃËûÃÇÖ®ÖеÄһЩ»òÈ«²¿½øÐÐÀàÐÍת»»£¬ÕâÖÖת»»ÓÐÁ½ÖÖÐÎʽ£¬Ò»ÖÖÊDZàÒëÆ÷×Ô¶¯½øÐе쬽ÐÒþʽÀàÐÍת»»£¬ÁíÒ»ÖÖÊDZà³ÌÖÐÇ ......
µÚ2ÕÂ
»·¾³£º·Òë»·¾³: Ô´´úÂëת»¯³É¿ÉÖ´ÐеĻúÆ÷Ö¸Áî¡£
Ö´Ðл·¾³£ºÓÃÓÚʵ¼ÊÖ´ÐдúÂë¡£
·Ò룺ԴÎļþ-¡µÄ¿±êÎļþ-¡µ¿ÉÖ´ÐÐÎļþ£¨Í¨¹ýÁ´½ÓÆ÷½«¶à¸öÄ¿±êÎļþÀ¦°óÔÚÒ»Æð£©
±àÒë¹ý³Ì£ºÔ¤´¦ÀíÆ÷-¡µÔ´´úÂë¾¹ý½âÎö²úÉúÄ¿±ê´úÂ루Õâ¸ö¹ý³ÌÖÐÊǾø´ó¶àÊý´íÎóºÍ¾¯¸æ²úÉúµÄµØ·½£©-¡µÓÅ»¯Æ÷£¨¾ÍÊǶÔÄ¿±ê´úÂë½øÐнøÒ»²½ÓÅ»¯£¬Ê¹Ð§ÂÊ ......
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 ......
#include <list.h>
#include <dirent.h>
#include <iostream.h>
#include <sys/stat.h>
#include <sys/types.h>
/*****************************************************************
*º¯Êý¹¦ÄÜ: Ä¿_¼_±é_Àú.
*·µ»ØÖµ: ³É¹¦·µ»Ø0,ʧ°Ü·µ»Ø·Ç0.
*²ÎÊý path ......