title: at() not working in function
body: <p>I believe that I am doing everything right, but the string is not being filled with the characters it is assigned. Here is what I know by testing: random is the correct character, q is the correct int, and s[i].name is a string. I have tried using .at(q) and [q], but nothing is working. </p>
  
  <p>This is my error:</p>
  
  <p>terminate called after throwing an instance of 'std::out_of_range'
    what():  basic_string::at
  Abort (core dumped)</p>
  
  <pre><code>for (int i = 0; i &lt; num; i++) {
      int q = 0;
      char random = 50;
      for (; random != 32;) {
          file.get(random);
          s[i].name.at(q) = random;
          q++;
      }
      q = 0;
  }
  cout &lt;&lt; s[0].name;
  </code></pre>