-1

I'm trying to test freopen("inputs.txt","r",stdin); but it is not working.Here is my code below:

#include <iostream>

using namespace std;

int main() {

    freopen("inputs.txt","r",stdin);

    int n;
    cin >> n;

    cout << n << endl;

    return 0;
}

There is only one integer number in my input file and it is in the same directory.
Can anyone help?

1 Answers1

0

Sorry I had a problem with the file path.File path should be in full form like

freopen("Users/mahfuz/inputs.txt","r",stdin);

this worked for me.