agent_bean
agent_bean

Reputation: 1585

How to correctly check FileStreamWriter is in use?

I am using a System::IO::StreamWriter. My intention is to check if the file in use is open, and close it.

What is the correct way of checking if the file is in use. I keep getting System.NullReferenceException with the code below.

if (filewr2->BaseStream != nullptr)
{
    filewr2->Close();
    filewr2 = nullptr;
}

Upvotes: 0

Views: 30

Answers (0)

Related Questions