Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Coding style conformance

...

Code Block
bgColor#ffcccc
langcpp
#include <fstream>
#include <string>

void f(const std::string &file_namefileName) {
  std::fstream file(file_namefileName);
  if (!file.is_open()) {
    // Handle error
    return;
  }
  
  file << "Output some data";
  std::string str;
  file >> str;
}

...

Code Block
bgColor#ccccff
langcpp
#include <fstream>
#include <string>

void f(const std::string &file_namefileName) {
  std::fstream file(file_namefileName);
  if (!file.is_open()) {
    // Handle error
    return;
  }
  
  file << "Output some data";
 
  std::string str;
  file.seekg(0, std::ios::beg);
  file >> str;
}

...