static int file_count(char *path)
{
DIR * p_dir = NULL;
struct dirent * dp = NULL;
int file_quantity = 0;
p_dir = opendir(path);
if (p_dir == NULL) {
return (-1);
}
return file_quantity;
}
int main(void)
{
std::string path = "/home/ac-test";
file_count(path.c_str());
return 0;
}
编译时报了以上错误,修改为:
static int file_count(const char *path)
编译通过。