Visual Studio Txt file opening

1

I'm running visual studio in parallels on a macbook air. First time I'm using C++ to open txt files and it seems to work only when debugging but not when I run without debugging.

example code:

ofstream outfile;
outfile.open("Subscription.txt");
if (outfile.is_open())
{
    outfile << name << "\n";
    outfile.close();
    cout << "Welcome to the discount club!" << endl;
}
else
    cout << "file won't open" << endl;

When I run it in the local debugger it outputs "Welcome to.." and when I run it without debugging it outputs "file won't open"

Maybe it's some kind of mac/parallels problem?

Adam Morad

Posted 2015-05-22T14:16:20.347

Reputation: 11

1What version of Windows are you using within your virtual machine? – Ramhound – 2015-05-22T14:23:22.383

1Try specifying an absolute path to where Subscription.txt is. – Ƭᴇcʜιᴇ007 – 2015-05-22T14:30:43.873

I am using windows 8.1 professional and absolute path solution not working – Adam Morad – 2015-05-22T21:18:15.050

No answers