simulator_modules/memory.c
/** memory directory count file
 * This function counts the number of files in a directory and returns the number of files it found
 * if the directory cannot be opened it returns -1
 * @param directory_path the path of the directory
 * @return the number of files, -1 if the directory cannot be opened
 */
memory directory count file
This function counts the number of files in a directory and returns the number of files it found
if the directory cannot be opened it returns -1
@param directory_path the path of the directory
@return the number of files, -1 if the directory cannot be opened
memory directory count file This function counts the number of files in a directory and returns the number of files it found if the directory cannot be opened it returns - 1 @param directory_path the path of the directory @return the number of files - 1 if the directory cannot be opened
int32_t memory_directory_count_files(char *directory_path)
{
	struct dirent *pDirent;
	DIR *pDir;
	int32_t ret = 0;
	char abs_directory_path[256];
	snprintf(abs_directory_path, 256, "%s/%s", path_in_windows, directory_path);
	pDir = opendir(abs_directory_path);
	if (pDir != NULL)
	{
		while ((pDirent = readdir(pDir)) != NULL)
		{
			printf("[%s]\n", pDirent->d_name);
			if (pDirent->d_name[0] == '.')
			{
			}
			else
			{
				++ret;
			}
		}
	}
	else
	{
		printf("Cannot open directory '%s'\n", directory_path);
	}
	closedir(pDir);
	return ret;
}
int32_t memory_directory_count_files ( char * directory_path ) { struct dirent * pDirent ; DIR * pDir ; int32_t ret = 0 ; char abs_directory_path [ 256 ] ; snprintf ( abs_directory_path , 256 , " " , path_in_windows , directory_path ) ; pDir = opendir ( abs_directory_path ) ; if ( pDir != NULL ) { while ( ( pDirent = readdir ( pDir ) ) != NULL ) { printf ( " \n " , pDirent -> d_name ) ; if ( pDirent -> d_name [ 0 ] == ' ' ) { } else { ++ ret ; } } } else { printf ( " \n " , directory_path ) ; } closedir ( pDir ) ; return ret ; }
memory directory count file
 This function counts the number of files in a directory and returns the number of files it found
 if the directory cannot be opened it returns -1
 @param directory_path the path of the directory
 @return the number of files, -1 if the directory cannot be opened
memory directory count file This function counts the number of files in a directory and returns the number of files it found if the directory cannot be opened it returns - 1 @param directory_path the path of the directory @return the number of files - 1 if the directory cannot be opened
// Ensure we can open directory. // ignore dot entries // Close directory and exit.