首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

VC中用DeleteFile删除指定文件出错,该如何处理

2012-02-11 
VC中用DeleteFile删除指定文件出错原代码如下:#includestdafx.h #includewinbase.h intmain(intargc,c

VC中用DeleteFile删除指定文件出错
原代码如下:
#include   "stdafx.h "
#include   "winbase.h "

int   main(int   argc,   char*   argv[])
{
      ::DeleteFile   ( "d:\\abc.txt ")   ;
      return   0   ;
}

MSDN2005查DeleteFile有:
      Requirements
      Header   :   winbase.h  
      Library   :   coredll.lib  
所以加了头文件 "winbase.h ",在LINK加了coredll.lib,编译出错。
如果头文件是 "Winsock.h ",LINK加Ws2_32.lib就成功。
难道MSDN里面有错?

[解决办法]
#include <windows.h> 即可

热点排行