How to use function freopen_s

后端 未结 2 888
余生分开走
余生分开走 2021-01-13 21:36

In order to read input from a text file, I wrote the following code:

int main(){
    int x;
#ifndef ONLINE_JUDGE
    freopen(\"input.txt\", \"r\", stdin);
#e         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-13 21:43

    I would give you an alternate way. If you still want to use freopen, you can use "-D _CRT_SECURE_NO_WARNINGS" this option with the terminal command, the error message will be suppressed.

    In VS you can add it under the following link -

    Project-> "Project" Properties -> C/C++ -> Command Line -> Additional Options(Text box on bottom right).

    This should resolve the issue!

提交回复
热议问题