Question: Working on C + + in a VS 2 0 2 2 environment and getting warning in the code below. warning C 4 9 9
Working on C in a VS environment and getting warning in the code below.
warning C: strcpy: This function or variable may be unsafe. Consider using strcpys instead. To disable deprecation.
warning C: 'strtok': This function or variable may be unsafe. Consider using strtoks instead. To disable deprecation, use CRTSECURENOWARNINGS. See online help for details.
warning C: 'strcat': This function or variable may be unsafe. Consider using strcats instead. To disable deprecation, use CRTSECURENOWARNINGS. See online help for details.
#include "SortStrings.h
void ReorderAlphabeticalconst char const inString, char const outString
sizet len strleninString;
char buff charcalloclen sizeofchar;
char buff buff len ;
strcpybuff inString;
char token strtokbuff;
std::vector tokenList;
sizet i ;
while token
tokenListi token;
i;
token strtokNULL;
sizet size i;
i ;
for i ; i size ; i
for sizet j ; j size i; j
if strcmptokenListj tokenListj
char tmp tokenListj;
tokenListj tokenListj ;
tokenListj tmp;
for i ; i size; i
printfs
tokenListi;
strcatbuff tokenListi;
if i size
strcatbuff;
strcpyoutString buff;
freebuff;
void ReorderWordLengthconst char const inString, char const outString
sizet len strleninString;
char buff charcalloclen sizeofchar;
char buff buff len ;
strcpybuff inString;
char token strtokbuff;
std::vector tokenList;
sizet i ;
while token
tokenListi token;
i;
token strtokNULL;
sizet size i;
i ;
for i ; i size ; i
for sizet j ; j size i; j
if
strlentokenListj strlentokenListj
strlentokenListj strlentokenListj && strcmptokenListj tokenListj
char tmp tokenListj;
tokenListj tokenListj ;
tokenListj tmp;
for i ; i size; i
printfs
tokenListi;
strcatbuff tokenListi;
if i size
strcatbuff;
strcpyoutString buff;
freebuff;
End of File
I think I need to change strcpy strtok, and strcat to strcpys strtoks and strcats Please change it
Please do not change the code structure or warning suppress.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
