Why is my basic file program not working?

Hello I've worked with files before so why now does this one not work?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <windows.h>
#include <fstream>
using namespace std;


int main()
{
    //FreeConsole();
    SetConsoleTitle("Key_Logger");
    ofstream log;
    log.open("Log.txt");
    log << "test!";
    log.close();
}


And the error message is:
ld.exe||cannot open output file bin\Release\Key_logger.exe Permission denied|

Run as administrator.
Thanks I don't know why I didn't think about that.
Topic archived. No new replies allowed.