parsing - Copy one line of text from a file to a string in c++ -


I need to copy a line of text from a text file in C ++, I have a word that is There is a program to search for that word, so I decided that I could just take each individual line and load it into a string, I can search the line in line, the correct word in the file by string and Its status (in the letters, do not bring) Find s). Help would be greatly appreciated.

Edit: I think the code I'm using to locate the line

  #include    

You only need one loop to complete it. Your loop should look something like this:

  while (getline (in_stream, str)) {lines ++; Size_t pos = str.find (search, 0); If (pos! = String :: npos) {size_t position = characters + pos; Cout & lt; & Lt; "Found in line" & lt; & Lt; Line & lt; & Lt; "More Character" & lt; & Lt; Status & lt; & Lt; Endl; } Letter + = str.length (); }   

I also recommend that you do not mix int and size_t types, for example, the character should be declared as size_t, not int.

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 -