通过 Windows.h 函数关闭打开的文件 [英] Close an open file via Windows.h function
本文介绍了通过 Windows.h 函数关闭打开的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我知道它的名称,如何在 Windows 中关闭打开的文件,例如C:\1.txt"(它是通过 CreateFile(...) 打开的)?谢谢
How to close an open file in Windows if I know its name, for example "C:\1.txt" (it is opened vis CreateFile(...))? Thanks
推荐答案
只需 关闭 调用 CreateFile 时创建的句柄.CloseHandle()
Just close the handle that was created when you made a call to CreateFile. CloseHandle()
顺便说一句,当您拥有 C++ 标准方法来处理文件时,为什么还要使用 Windows API?
BTW, why use windows API when you have C++ standard methods to handle files?
参见这个
这篇关于通过 Windows.h 函数关闭打开的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文