LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1022|回复: 1

stat函数的奇怪问题

[复制链接]
发表于 2006-10-5 23:44:40 | 显示全部楼层 |阅读模式
home.html和这个程序是在一个目录的,但是我用"./home.html"的话就会打印出not found,只有用绝对路径stat才能找到文件,这是为什么呢?

#include <stdio.h>
#include <sys/stat.h>

int main(void){
char *filename = "./home.html";
struct stat sbuf;
if(stat(filename,&sbuf) < 0){
printf("not found");
} else{
printf("ok");
}
}
发表于 2006-10-6 01:28:43 | 显示全部楼层
试了一下,没有你说的现象。
ubuntu edgy/gcc 4.1.2/glibc 2.4
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表