无效的句柄异常c00000008 [英] Invalid Handle exception c00000008

查看:139
本文介绍了无效的句柄异常c00000008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试在Builder c ++中创建一个基本文件,但是却收到无效的句柄异常c00000008".

这是我唯一的按钮后面的代码.

Hi All,

I am trying to create a basic file in Builder c++, however I get a ''Invalid Handle exception c00000008''.

This is the only code I have, behind a button.

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TFileStream* fs;

  fs = new TFileStream("c:\\test.log", fmCreate);
}

推荐答案

您确定异常在显示的单行代码中发生吗?这不能是您拥有的唯一代码".

fs,指向该流的指针是局部变量,因此在此函数退出时将其丢弃.因此,由于您不将句柄返回到文件中,因此您打算如何处理刚刚创建的文件. 无效句柄"是其他人想要触摸该文件的线索.
Are you sure the exception occurs on the single line of code you show? This can not be "the only code" you have.

fs, the pointer to the stream is a local variable and hence discarded when this function exits. So, what do you intend to do with the file you just created since you do not return the handle to the file. "Invalid Handle" is a clue that somebody else wants to touch that file.


这篇关于无效的句柄异常c00000008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆