首页 > 编程语言 > 详细

[C 语言]判断某文件是文件夹还是文件

时间:2017-12-02 10:10:04      阅读:224      评论:0      收藏:0      [点我收藏+]

#include <sys/stat.h>

#include <stdio.h>

int _tmain(int argc, _TCHAR* argv[])
{

char* fileName = "D:\\aa.txt"; 
struct _stat buf; 


int result; 
result = _stat( fileName, &buf ); 
if(_S_IFDIR & buf.st_mode){ 
printf("folder\n"); 
}else if(_S_IFREG & buf.st_mode){ 
printf("file\n"); 


return 0;
}

http://blog.csdn.net/jaken99/article/details/77657480

[C 语言]判断某文件是文件夹还是文件

原文:http://www.cnblogs.com/findumars/p/7952879.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!