cstdiofile “disk full while accessing” file with CFile::modeCreate on existing file (to overwrite it)

  Kiến thức lập trình

I am using MFC and C++. Based on user input, I need to either create a new file or re-create it if it exists. In both cases I get the error message “disk is full”.

Initially, if I discover that the file exists, I open it and read its content successfully. I then close the file.
Later, I need to re-create the file using CFile::modeCreate |CFile::modeWrite and I get the “Disk is full” message.

The disk (a separate physical drive) has 170 GB of available space. I can use Notepad to insert data to the file, regardless if it is empty or has data in it. Using a try-catch with CFileException TRACE I find that the file is not really closed. Filecore.cpp line 179 shows: // shouldn’t open an already open file (it will leak)
ASSERT(m_hFile == INVALID_HANDLE_VALUE);

Tried without the modeWrite option. No difference.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT