void display_dir(const char* path, ofstream& file, bool print) { struct dirent **contents; char cwd[256]; unsigned int num_entries = 0; if ((string)path == "") num_entries = scandir(getcwd(cwd,sizeof(cwd)), &contents,NULL,alphasort); else num_entries = scandir(path,&contents,NULL,alphasort); if(num_entries == -1 ) { if(print) file<<"ERROR: myshell: "<d_name[0] != '.') file<d_name<<" "; } file<d_name[0] != '.') cout<d_name<<" "; } cout<