block type is valid

Hello everybody!
Program error! Help me please.

So, I have a list of files. I need to move them into another directory (call DIR). so, DIR is consist of several directories. All files from list I need to "branch" into directories in DIR. I use this function:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
char* pack::FindFileOnServer(char* filename)
{
	printf("%s\n",filename);
	//this->buf;//filename
	int i=0;
	int j=0;
	/*while(this->buf[i]!=0) i++;
	char* tmp = new char[i+1];
	strcpy(tmp,this->buf);
	tmp[i]=0;*/
	HANDLE hFind = INVALID_HANDLE_VALUE;
	char string[MAX_PATH];
	WIN32_FIND_DATA winData;
	//DWORD dwError;
	//pack *tmp;
	strcpy( string, filename ); 
	strcat( string, "\\*");
	hFind = FindFirstFile(string, &winData);
	if (hFind != INVALID_HANDLE_VALUE) 
	{
		while (FindNextFile(hFind,&winData)!=0)
		{
			if(strcmp(winData.cFileName,"..")==0) continue;
			if(winData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
			{
				char* string2 = new char[strlen(filename)+strlen("\\")+strlen(winData.cFileName)+1];
				strcpy(string2,filename);
				strcat(string2,"\\");
				strcat(string2,winData.cFileName);
				//tmp = this;
				//delete []tmp;
				char* tmp = this->FindFileOnServer(string2);
				/*this->buf = this->FindFileOnServer(string2);*/
				if(0!=strcmp(this->buf,tmp)) 
				{
					delete []string2;
					string2=NULL;
					//delete []tmp;
					//tmp = new char[strlen(this->buf)+1];
					//strcpy(tmp,this->buf);
					//tmp[strlen(tmp)]=0;
					FindClose(hFind);
					return tmp;
				}
				if(string2) {delete []string2;string2 = NULL;}
				//if(tmp) {delete []tmp;tmp=NULL;}
			}
			j=0;
			while(this->buf[j]!='.')
				if(this->buf[j]!=winData.cFileName[j]) break;
				else j++;
			if(winData.cFileName[j]=='.' && this->buf[j] == '.')
			{
				char* file = new char[strlen(filename)+strlen("\\")+strlen(winData.cFileName)+1];
				strcpy(file,filename);
				strcat(file,"\\");
				strcat(file,winData.cFileName);
				//if(tmp) {delete []tmp;tmp=NULL;}
				//if(string2) {delete []string2;string2=NULL;}
				FindClose(hFind);
				return file;			//провериьт
			}
		}
	}
//	delete []tmp;
//	tmp = NULL;
	FindClose(hFind);
	return this->buf;
	/*delete []tmp;
	tmp = new char[strlen(this->buf)+1];
	strcpy(tmp,this->buf);
	tmp[strlen(tmp)]=0;
	return tmp;*/
}



All is fine but on 5-10 min of transfering I see what I see. Assert failer. block type is valid and so on.. Why?? my brain is cruing((
sorry, I think this code is not reference document. Question still open, why can be assert fail Block type is valid?
Topic archived. No new replies allowed.