Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Draft saved
Draft discarded
Cancel
14
  • 6
    Why do you think you should use freopen (and std::cin, std::cout)? Use std::ofstream learncpp.com : 28.6 — Basic file I/O Commented Jan 12, 2025 at 15:04
  • 3
    Recommendation : fully switch to "visual studio community edition" it is much more easy to use than "visual studio code" Commented Jan 12, 2025 at 15:06
  • ofstream do not work either. Visual Studio is not available on ICPC World Finals docs.icpc.global/worldfinals-programming-environment Commented Jan 12, 2025 at 15:11
  • 1
    First of all, always check for failure. In your case check what freopen returns. If it fails, use strerror to get a printable string of the error from errno. And to emphasize what others have said, use standard C++ facilities for all your file input and output. Commented Jan 12, 2025 at 15:14
  • 1
    ofstream should work, but be sure you set the "working directory" of your final directory to a place where you have rights to write files. Considering the link you sent : make sure you practice on Linux (so you are familiar with the linux file system behavior too). Commented Jan 12, 2025 at 15:31

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /