C/C++ 路径为目录判断
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
/****************************************************
* 函数功能: 判断参数路径是否为(正确的)目录
* 函数返回: 0为表示路径为文件,1为非目录.其他为错误
* 参数: path文件需要判断的目录的路径.
* 可以为相对路径.
*
*****************************************************/
int isDir(const char *path)
{
struct stat info;
if ( 0 != stat(path,&info) )
{
return -2;
}
if( info.st_mode & S_IFDIR )
{
return 0;
}
else
{
return 1;
}
}
相关文档:
系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......
一、XML只有一个Table的情况
(1)userInfo.xml
<?xml version="1.0" encoding="utf-8" ?>
<UserInfo ......
第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 ......