Monday 21 January 2013

prnenv v2


Here is the updated code that prints out a list of suggested matches: All the updated code has already been pushed to the repo if you wish to view the full code.

                    else{
/* If the search is not a complete match,
  then it prints out a list of partial matches.
*/
cout << "That environmental variable is not found." << endl;
cout << "Did you mean:" << endl;
for(x=0;env[x]!=0;x++){
pch=strstr(env[x], str);
if(pch){
pch2 = NULL;
pch2 = strtok (env[x], "=");
if(pch2)
cout << pch << endl;
} // End of if
} // End of for
// Resets result variable back to original size to allow proper deletion.
strcpy(result, env[y]);
delete [] result;
} // End of else

No comments:

Post a Comment