vs code access denied cpp

  access-denied, c++, visual-studio-code

im trying to setup my vscode and this is the code ive written so far. but it says access denied.

#include<bits/stdc++.h>
using namespace std;

#define OJ 
    freopen("input.txt","r",stdin); 
    freopen("output.txt","w",stdout);

int main()
{
    OJ;
    int a;
    cin>>a;
    cout<<a;
    return 0;
 }

this is the error shown :

Program 'sample.exe' failed to run: Access is deniedAt line:1 char:93
+ ... scode" ; if ($?) { g++ sample.cpp -o sample } ; if ($?) { .sample }
+                                                                ~~~~~~~~.
At line:1 char:93
+ ... scode" ; if ($?) { g++ sample.cpp -o sample } ; if ($?) { .sample }
+                                                                ~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

Source: Windows Questions C++

LEAVE A COMMENT