Boolean fun (char * pszPath)
{
Char szFileList [] [MAX_PATH * 2]={0};
Int iNum=searchFile (pszPath szFileList [] [MAX_PATH * 2]).
//processing after the completion of the memory how to safely release
}
Int searchFile (char * pszDirectory, char szFileList [] [MAX_PATH * 2])
{
.
//find file
Char szFindFileName [MAX_PATH * 2]={0};
//find szFindFileName file name, how to join szFileList, return
.
//return the number of files to find the
Return inum;
}
CodePudding user response:
, the size of the array, seemingly can't use variables to a constant, 10100, for example, if you MAX_PATH is pre-defined, but can't * 2, after such definition, an array of memory automatic release,CodePudding user response:
After a predefined MAX_PATH, such definition no problem, the space allocated on the stack, function returns automatically to release theChar szFileList [] [MAX_PATH * 2]={0};
Alright with this definition function
Int searchFile (char * pszDirectory, char szFileList [] [MAX_PATH * 2])
Can be defined as
Int searchFile (char * pszDirectory, char * * szFileList)
CodePudding user response:
Semantically I don't understand why want to add szFindFileName szFileList,But you really need it, to a free line is found in szFileList then strcpy inside,
CodePudding user response:
Hit the submit buttonStrcpy (szFileList [I], szFindFileName);
If you know what that line free or available,
CodePudding user response: