title: How to uppercase a char array c++
body: <p>Hey guys, </p>
  
  <p>I've seen a lot of posts around the internet about this, but I still don't understand how to do that exactly.  For some reason, I can only uppercase my char array until there is a space...</p>
  
  <pre><code>    #include "stdafx.h"
      #include &lt;iostream&gt;
      #include &lt;string&gt;
  
  
      std::string caps (char[]);
  
  
      int main() { 
          const int MAXLEN = 256;     
          char chaine[ MAXLEN ] = "";  
  
          //Here i am inputting my list of char into my array
          std::cout &lt;&lt; "Chaîne ? ";
          std::cin &gt;&gt; chaine; 
  
          //Calling my caps function
          caps( chaine );
  
          // results
          std::cout &lt;&lt; "Résultat: " &lt;&lt; chaine &lt;&lt; std::endl;
  
          _gettch();
          return 0;
  
  
      }
  
  
      std::string caps (char chaine []){
  
  
      std::string check=chaine;
  
      for (int i=0; i&lt;=check.length(); i++){  //I added check.length() because it's the only way I know to check for the length of the array
  
  
      chaine[i]=toupper(chaine[i]);
  
      }
  
      return chaine;
  
      }
  </code></pre>
  
  <p>So let's say I write "Hey you"  The output will be "HEY" and that's it.  I am le confused.  Thanks for the help!</p>