-5

How to directly read a string in std::string from a file in C++?

The examples I saw all use char xx[200];

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
yuexia_wrp
  • 51
  • 6

2 Answers2

1

Use like, File_object>>string_variable;

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
0

The <string> realized a >> operator, that can read a string into std::string directly from std::istream.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
yuexia_wrp
  • 51
  • 6