my this program is working when the argument is not provided why its not working when i m providing argument?
code :
#include<iostream>
#include <dirent.h>
using namespace std;
int main(int agrc ,char val[])
{
DIRdir;
struct dirent * abcd;
if(!val[1])
{
/cout << "Invalid Execution Style: Use <Program Name> <Folder location>\n";/
dir = opendir(".");
if(dir !=NULL)
{
while ((abcd=readdir (dir))!=NULL)
{
if( abcd->d_name[0] != '.' )
printf ("[%s]\n", abcd->d_name);
\}
closedir\(dir\);
exit\(0\);
\}
dir = opendir\(val[1]\);
if\(dir !=NULL\)
\{
while \(\(abcd=readdir \(dir\)\)!=NULL\)
\{
if\( abcd->d_name[0] != '.' \)
printf \("[%s]\\n", abcd->d_name\);
\}
closedir\(dir\);
return 0;
\}
\}
}