本文介绍了如何取消链接/删除Windows中的打开文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢您的任何建议。


~CP

Thanks for any advice.

~ CP

推荐答案



我不是特别了解Windows,但通常你需要关闭

文件或尝试删除将失败。


system(" del C :\\path\\to\\ file");


将删除。

I don''t know about Windows specifically but generally you need to close the
file or the attempted deletion will fail.

system("del C:\\path\\to\\file");

will delete.




我不是特别了解Windows,但通常你需要

关闭文件或尝试删除将失败。


system(" del C:\\path\\to\\file");


将删除。

I don''t know about Windows specifically but generally you need to
close the file or the attempted deletion will fail.

system("del C:\\path\\to\\file");

will delete.



为了保持这个半主题,标准C提供了remove()函数。

但结果是实现定义 ;如果文件是打开的,那么

是可移植的,你需要先关闭它。我也不知道Windows实现通常会做什么,但我认为如果

文件打开,它们可能会失败。请参阅C编译器/库的文档。

作为旁注,通常是指可能是夸大其词;在Unix上,删除一个打开的文件是完全合法的
。该文件将被取消链接。 (所以

它不再出现在文件系统中,除非有其他链接到

)但是数据将保留在磁盘上,无论谁拥有它都可以访问/>
打开,直到它们都关闭它,此时数据实际上是删除了b $ b。这通常是一个有用的功能。我不知道Windows

是否提供了相同的东西,但我的猜测是否定的;这是我的印象,

Windows哲学是禁止你搞乱一个打开的文件。

To keep this semi-on-topic, standard C provides the remove() function.
However the results are "implementation defined" if the file is open, so
to be portable you would need to close it first. I also don''t know what
Windows implementations usually do but I think they might fail if the
file is open. See the documentation for your C compiler / library.

As a side note, the "generally" may be an overstatement; on Unix it is
entirely legal to remove an open file. The file will be "unlinked" (so
it no longer appears in the filesystem, unless there are other links to
it) but the data will remain on the disk, accessible to whoever has it
open, until they all close it, at which point the data is actually
deleted. This is frequently a useful feature. I do not know if Windows
provides anything equivalent but my guess is no; it''s my impression that
the Windows philosophy is to forbid you from messing with an open file.



我不知道Windows具体但是

I don''t know about Windows specifically but



[...]

[...]



[...]


以上答案应该是一个强有力的线索,这不是你问题的最佳

的地方。 (我不知道


标准C提供了remove()函数;如果文件

打开,它的行为取决于系统。


如果你想要特定于Windows的信息(看起来像你需要的那样),请尝试在comp.os.ms-windows.programmer.win32中询问无论你发布什么

,我建议在你的

文章正文中加入这个问题。


-

Keith Thompson(The_Other_Keith)< http://www.ghoti.net / ~kst>

诺基亚

我们必须做点什么。这是事情。因此,我们必须这样做。

- - Antony Jay和Jonathan Lynn,是部长

[...]

The above answers should be a strong clue that this is not the best
place for your question. (I don''t know

Standard C provides the remove() function; how it behaves if the file
is open depends on the system.

If you want Windows-specific information (which appears to be what you
need), try asking in comp.os.ms-windows.programmer.win32. Wherever
you post, I suggest including the question in the body of your
article.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


这篇关于如何取消链接/删除Windows中的打开文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:38