Seperate string as delimiter strtok (C++)
<p><br>
I have a text<br>
I need to find in each proposal max word and min word.(Separated by dots)<br>
I wrote a function to find it.<br>
I'm trying to send first seperated proposal to a function</p>

<pre><code>calculateString(token);
</code></pre>

<p>.
After this variable token is truncated.
Thanks for answers!</p>

<p>Updated:<br>
Question:I need to found in each proposal max and min text.On the first step it's truncated.How can I avoid it?(Do not truncate after using it) –</p>

<p>Code:</p>

<pre><code>//Output/input /cin/cout
#include &lt;iostream&gt;
//System libary
#include &lt;cstdlib&gt;

//include printf/sprintf/scanf
#include &lt;stdio.h&gt;

//include string libary
#include &lt;string&gt;

//
#include &lt;ctype.h&gt;
#include &lt;conio.h&gt;

using namespace std;

void calculateString(char *str){
    char *temp;
    int len;
    int i = 0;
    char** stringArray;
    string long_word,short_word;

    temp = strtok(str," ,.!?");
    cout &lt;&lt; "Str:" &lt;&lt;  str &lt;&lt; "\n";
    int string_count = 0;//counting first word in string. 
    int string_count_short = 0;
      stringArray = new char*[string_count];
        while(temp = strtok(NULL," ,.!?"))
        {
                //cout &lt;&lt; "\n" &lt;&lt; temp &lt;&lt; "\n";
                len = strlen(temp);
                if(len&gt;string_count || string_count == 0){
                    string_count = len;
                    long_word =  temp;
                }
                if(len&lt;string_count_short || string_count_short == 0){
                    string_count_short = len;
                    short_word=  temp; 

                }
        }       
       cout &lt;&lt; "Longest word in all text is:" &lt;&lt;  long_word &lt;&lt; "\n";
       cout &lt;&lt; "Shortest word in all text is:" &lt;&lt;  short_word &lt;&lt; "\n";
}
int main()
{
   char str[] = "Hello it's a test.Lets go.How are you?Andrej";
   char seps[]   = ".";

   char *token;
   token = strtok( str, seps );
   while( token != NULL )
   {
      /* While there are tokens in "string" */
      cout &lt;&lt; " :: " &lt;&lt; token &lt;&lt; " ||\n";
      calculateString(token);

      /* Get next token: */
      token = strtok( NULL, seps );
   }
    //calculateString(str);

    system("pause");
    return 0;
}
</code></pre>
