uuencode.decode删除文件失败后解码后

发布于 2025-01-26 16:56:54 字数 629 浏览 1 评论 0原文

我正在使用uuencode.decode来解码一批uuencoded文件。有时,uuencoded文件之一是损坏的,导致uuencode.decode终止。我用尝试.. catch ..结束尝试,它成功地处理了无法解码特定的Uuencoded文件。

对于下一步,我需要删除Uuencoded文件。如果uuencode.decode成功,那么我可以继续删除uuencoded文件,但是如果uuencode.decode失败,导致捕获量,那么我将无法删除该文件,因为该文件仍然打开。

知道如何关闭uuencode.decode剩下的文件,以便我可以继续删除它?

这是代码:

Try

strOutputFilename = UUEncode.Decode(lblWorkingPath.Text & strFilename & ".uu", lblWorkingPath.Text)

Catch ex As Exception

strOutputFilename = ""

End Try


File.Delete(lblWorkingPath.Text & strFilename & ".uu")

I am using UUEncode.Decode to decode a batch of UUEncoded files. Occasionally one of the UUEncoded files is corrupt, causing UUEncode.Decode to terminate. I handle this with Try .. Catch .. End Try, which successfully handles the failure to decode a particular UUEncoded file.

For the next step I need to delete the UUEncoded file. If the UUEncode.Decode was successful then I can go on to delete the UUEncoded file, but if the UUEncode.Decode failed, causing a catch, then I cannot delete the file as it is still open.

Any idea how to close the file left open by UUEncode.Decode so that I can proceed to delete it?

Here is the code:

Try

strOutputFilename = UUEncode.Decode(lblWorkingPath.Text & strFilename & ".uu", lblWorkingPath.Text)

Catch ex As Exception

strOutputFilename = ""

End Try


File.Delete(lblWorkingPath.Text & strFilename & ".uu")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文