hello guys!I would like to give a little help for a problem which stops me from my project.

take a look plz...<br>

void traverseDir( string dirname ){
    string   str;
    DIR *pDIR;
    struct dirent *entry;
    pDIR=opendir(dirname.c_str());
while((entry = readdir(pDIR)) != NULL ){
      if( isDir( dirname.c_str() ) ) {
	if( strcmp(entry->d_name, ".") != 0 
                        && strcmp(entry->d_name, "..") != 0 ){
            	        cout << entry->d_name <<endl;
                        string pathDir = dirname + "/" + ( entry->d_name );
                         traverseDir( pathDir );
                        cout <<"verify: " << dirname <<endl;
                         chdir( dirname.c_str() );
	}
      }
       else {
         	cout << "This is file: " << entry->d_name <<endl;
      }
		
} //while
      closedir(pDIR);
}

compiler borland C++ 5.02.
Fault:Access Violation at 0x406be3:
read of address 0x8.
I'would be really appreciate if you could give me a hand.Thanks for the moment...

hello guys!I would like to put some notes as for the function isDir.

bool isDir(const char* _dir)
{
	bool bResult = true;

	if ( strlen(_dir) > 0)
	{
		if(GetFileAttributes(_dir) != FILE_ATTRIBUTE_DIRECTORY)
			bResult= false;
	}

	return bResult;
}

Thanks a lot...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.