You don't have to use the stripnulls function in C++. I didn't. Here is the code , it is a little changed (mixed up) and with some new lines of code. You may find it different because it uses MFC(CString). Should be no problem not to use char.
Code:
//in header CString dd = "" and CString tt="";
void CAllDlg::car1(CString dir)
{
vector<CString> vec;
WIN32_FIND_DATA finddata; 
HANDLE file;
file = FindFirstFile(dir + "*",&finddata);
int c = 1;
int i = 0;
BOOL dts,dr;
do
{
c = FindNextFile(file,&finddata);
CString d = finddata.cFileName ;
dts = (d != "." && d != ".." &&  strlen(d) > 0);


dr = ((GetFileAttributes(dir + d) & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);

if(dts == TRUE)
{
	if(dr == FALSE)
	{
		if(dd != (dir+d))
		{
		l1.AddString (dir + d);
		dd = (dir+d);
		}
	}
	else if(dr == TRUE)
	{
		
		if(tt != d)
		{
	vec.push_back (d);
		tt = d;
		}
	}
}
}while(c != 0);
FindClose(file);
long ff = vec.size ();

for(int x= 0;x<ff;++x)

car1(dir + vec.at (x) + "\\");

}