title: How to edit a row in a text file with C++?
body: <p>I have a txt file like this:</p>
  
  <pre><code>"shoes":12
  "pants":33
  "jacket":26
  "glasses":16
  "t-shirt":182
  </code></pre>
  
  <p>I need to replace the number of jacket ( from 26 to 42 for example ). So, I have wrote this code, but I don't know how to edit a specific row where there is the word "jacket":</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt; 
  
  using namespace std;
  
  int main() {
  
      ifstream f("file.txt");
      string s;
  
      if(!f) {
          cout&lt; &lt;"file does not exist!";
          return -1;
      }
  
      while(f.good()) 
      {       
          getline(f, s);
          // if there is the "jacket" in this row, then replace 26 with 42.
      }
  
  
      f.close(); 
      return 0;
  }
  </code></pre>