How to separate a column of numbers from string lines of varying lengths in C++? -


Thanks in advance for your help I am looking to read the file that has the following format: < Pre> 100 each row has 23452 different numbers 30 words

If I use the line reading method by line:

file & gt; ; & Gt; Number [i] & gt; & Gt; Str

This does not work clearly, because the string is empty. Does anybody have any idea how can I do this? I am interested in saving numbers in only one array. Thanks!

read a line using fstream and stop it on the given character (such as a location):

to

  Eastern & amp; Gateline (cell * s, stream no, four delimited);   

If the delimiter is detected, it is removed and released, i.e. it is not stored and after this the next input operation will begin.

After this, you will convert the first part of the line, convert it to int or other number format, to catch the remaining line, the other getline < / Code> (this automatically clears the character on the new line), then repeat.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -