title: Reading strings, integers etc from files using fscanf
body: <p>I'd like your help with understanding how should I do the following:</p>
  
  <p>I have a file that contains integers separated by spaces ' '. I need to read all integers, sort them and write them as a strings to another file. I wrote a code, but I read char by char, put the word in an  char sub_arr [Max_Int] and when I met ' ', I put these chars, now one string, after atoi-ing it into another Main int array,until reaching the end of the file, string by string,  and then I sorted and itoa-ing them and wrote them in another file.</p>
  
  <p>But then I remembered that there's a <a href="http://www.cplusplus.com/reference/clibrary/cstdio/fscanf/" rel="nofollow">fscanf</a>  function:I read about it and still I didn't understand completely what does it do and how to use it.</p>
  
  <p>In my case, where all integers separated by space, can I write <code>fscanf(myFile,"%s",word)</code>? would it know not to consider ' ' and stop at the end of the specific string?! How?</p>
  
  <p>More than that, Can I write <code>fscanf(myFile,"%d",number)</code> and it would give me the next number itself? (I must have misunderstood it. Feels like magic).</p>