c++ - File input/output and reading in a line -


So basically what my code wants to do is read in a row from the file

gt; & Gt; Filename & gt; & Gt; MPA & gt; & Gt; Rating 1 & gt; & Gt; Rating 2 & gt; & Gt; Rating 3 & gt; & Gt; Rating 4 & gt; & Gt; rating5;

Example input (from the first row in the file):

Frozen PG 13 1 2 3 4 5

That worked well

But if I want to do something like this:

Peter Pan PG 1 2 3 4 5

I will get the error because it MAPA will try to put a PAN and the rating will be 1 PG and so on. How do I get that code to recognize the space?

Change something else like comma to your separator, and try the following:

  meet (file 1, move name, ','); Gateline (file 1, mpa, ','); // etc   

If you need to read the line from the line and make sure that each row is correct, you first want to read the line with the getline (file1, line) , and then use the string to start the istringstream to extract the values ​​separated by commas.

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -