C++ file-redirection

前端 未结 4 1953
伪装坚强ぢ
伪装坚强ぢ 2020-12-31 07:28

For faster input, I read that you can do file-redirection and include a file with the cin inputs already set.

In theory it should be used l

4条回答
  •  借酒劲吻你
    2020-12-31 07:52

    To use your code [1] you have to call your program like this:

    App.exe < inputfile > outputfile
    

    You can also use:

    App.exe < inputfile >> outputfile
    

    In this case the output wouldn't be rewritten with every run of the command, but output will be appended to already existing file.

    More information about redirecting input and output in Windows you can find here.


    Note that the <, > and >> symbols are to be entered verbatim — they are not just for presentation purposes in this explanation. So, for example:

    App.exe < file1 >> file2
    

提交回复
热议问题