0

In a large file, how to replace the certain word?

Is there is a way to delete a particular line or word in file?

EDIT:

My file is quite large. I cannot load entire file in to buffer and replace the buffer to file

VINOTH ENERGETIC
  • 1,775
  • 4
  • 23
  • 38
  • 1
    http://stackoverflow.com/questions/21180412/search-and-replace-string-in-txt-file-in-c – relaxxx Apr 10 '14 at 13:22
  • Ordinary files cannot do this unless you rewrite the entire file. Databases use complex file structures and code to accomplish delete or replace. – ScottMcP-MVP Apr 10 '14 at 13:29

1 Answers1

1

read each line from the file into a string, then apply std::string's replace (http://www.cplusplus.com/reference/string/string/replace/)

Dr. Debasish Jana
  • 6,980
  • 4
  • 30
  • 69