|
珞珈山水BBS →
电脑网络 →
操作系统 →
单文区文章阅读
|
| 单文区文章阅读 [返回] |
|---|
|
发信人: Stravadivaly (老子就是机器人), 信区: OS 标 题: FindFirstFileEx问题 发信站: BBS 珞珈山水站 (Sat May 27 17:14:16 2006) 下面是我的代码: #define _WIN32_WINNT 0x0400 #include <windows.h> #include <stdio.h> int main(void) { WIN32_FIND_DATA FindFileData; HANDLE hFind; char str[]="1.txt"; printf ("Target file is %s.\n", str); hFind = FindFirstFileEx(str, FindExInfoStandard, &FindFileData, FindExSearchNameMatch, NULL, 0 ); if (hFind == INVALID_HANDLE_VALUE) { printf ("Invalid File Handle. GetLastError reports %d\n", GetLastError ()); return (0); } else { printf ("The first file found is %s\n", FindFileData.cFileName); FindClose(hFind); return (1); } } 编译无问题,且运行前我已经在d盘的某个目录下面建了一个1.txt,但运行结果总是: Target file is 1.txt. Invalid File Handle. GetLastError reports 2 Press any key to continue 用Look up查看GetLastError = 2:系统找不到指定的文件。 -- 是吗? 不是吗? 对吗? 不对吗? 傻吗? ...... 的确很傻. 就像" 树动风欲静, 日涌大山流". ※ 来源:·珞珈山水BBS站 http://bbs.whu.edu.cn·[FROM: 221.232.24.*] |
| [返回单文区目录] |
|
|