title: sscanf to get segment of string surrounded by two fixed strings
body: <p>I'm trying to remove the extension of a file (I know it is <code>.txt</code>) using <code>sscanf()</code>. I've tried with many format strings I think may work, but with no success. The main problem is that I just can't understand <code>sscanf()</code>'s documentation, so I don't get how to use this <code>[=%[*][width][modifiers]type=]</code> I've tried to tell it that end must be ".txt" or to save initial string in a variable and a <code>%4c</code>corresponding to the extension in another one, but again… can't make it work.</p>
  
  <p>I know this has been asked before here: <a href="https://stackoverflow.com/questions/6510858/sscanf-get-first-and-last-token-in-a-string">sscanf: get first and last token in a string</a> but as I said... I don´t understand its solution.</p>
  
  <p>The part of my code that does that:</p>
  
  <pre><code>sscanf(fileName,"the_sender_is_%s%*[.txt]", sender);
  </code></pre>
  
  <p>The input file name is, for example: "the_sender_is_Monika.txt"</p>
  
  <p>In <code>sender</code> I should have</p>
  
  <pre><code>Monika
  </code></pre>
  
  <p>but whatever I try gives me</p>
  
  <pre><code>Monika.txt
  </code></pre>