lundi 1 février 2016

ofstream.is_open() always false

I've been trying for hours now, and I can't for the life of me get my application to write a simple file...

A bit about my setup:

  • Windows 10 updated.
  • DirectX12 default "spinning cube" application.
  • Visual Studio 2015

I am doing this:

ofstream outFile;
// I have even tried with \\ slashes...
outFile.open("c://Users//pookie//Documents//WHERETHEFISMYFILE.txt");
if (outFile.is_open())
{
    outFile << "Writing this to a file.\n";
    outFile.close();
}

I've also tried using fstream as well as doing !outfile.fail() I've checked every directory in my project, and even ventured out into the Microsoft DirectX SDK. I've tried setting an absolute path. I've tried adding permissions to the folder by allowing "everyone" and giving full access - just for sanity. I have also tried running Visual Studio in admin mode,=.

The problem occurs here: if (outFile.is_open()). For some reason, it always returns false..

What am I doing wrong here?

Aucun commentaire:

Enregistrer un commentaire