title: Read input txt files and format it in c
body: <p>I have a input file that has different content and length each line.
  Every line represents a command.</p>
  
  <pre><code>in
  cr foo   //create file "foo"
  op foo   //open it with index 1
  wr 1 x 60   //write x in index 1("foo") 60 times
  wr 1 y 10   //write y in index 1("foo") 60 times
  sk 1 55     //such and such...
  rd 1 10
  dr
  sv disk0.txt
  
  in disk0.txt
  op foo
  rd 1 3
  cr foo
  cl 1
  dr
  </code></pre>
  
  <p>I have looked at this answer, but it still not helpful for my question.
      <a href="https://stackoverflow.com/questions/4689747/how-to-read-specifically-formatted-data-from-a-file">How to read specifically formatted data from a file?</a>
  I really need help of how to read this input file correctly in order to perform different commands.
  The command may contain integers, or it main only have one character, I don't know how to deal with this text! Please help</p>