Home > Software engineering >  FindNextFile when browsing the Shared path will block does not return, the program card dead, how to
FindNextFile when browsing the Shared path will block does not return, the program card dead, how to

Time:09-25

Browse Shared path using FindNextFile function, sometimes function did not return, after go in and program always stuck there,

Encounter this kind of circumstance how to deal with, please? Microsoft do function how so unreliable, how should return!

CodePudding user response:

On code, whil cycle has a problem?

CodePudding user response:

Should be the support for network Shared path

CodePudding user response:

A lot of API did not increase the timeout mechanism, is really old fire

CodePudding user response:

System (" dir/b/a - d c: \ \ *. * & gt; D: \ \ allfiles TXT ");
//read file d: \ \ allfiles TXT content of C: \ \ under the names of all files
System (" dir/b/a - d/s c: \ \ *. * & gt; D: \ \ allfilesinsub TXT ");
//read file d: \ \ allfilesinsub TXT content that is C: \ \ under the names of all files contain subdirectories
System (" dir/b/active directory c: \ \ *. * & gt; D: \ \ alldirs TXT ");
//read file d: \ \ alldirs TXT content of C: \ \ under the names of all the subdirectories
Please remember, can use the shell command to get the file and folder information or manipulate files, folders had better use the shell command to get or operation, and don't use all sorts of API access to or operation, because when it comes to illegal folder name or illegal filename or illegal file length, illegal file date, compressed file, link files, sparse file... All sorts of unexpected situations, such as API can deal with incomplete or into an infinite loop, and shell commands not,
If disrelish black window system that the system ("... ") is replaced by WinExec (" CMD/c... ", SW_HIDE);

CodePudding user response:

Code is too complex, on the part of

 # ifdef DEBUG_INFO_PROGRESS 
If (NULL!=m_pFileBuffer)
M_pFileBuffer - & gt; ShowFileProgress (PROCESS_DEBUG_INFO_MSG2, (LPARAM) _T (" LocalFile: : Next: in "));
# endif

While (: : FindNextFile (m_hFind, & amp; M_fd))
{
# ifdef DEBUG_INFO_PROGRESS
If (NULL!=m_pFileBuffer)
M_pFileBuffer - & gt; ShowFileProgress (PROCESS_DEBUG_INFO_MSG2, (LPARAM) _T (" LocalFile: : Next: out1 "));//and file
# endif

/*... */
}

# ifdef DEBUG_INFO_PROGRESS
If (NULL!=m_pFileBuffer)
M_pFileBuffer - & gt; ShowFileProgress (PROCESS_DEBUG_INFO_MSG2, (LPARAM) _T (" LocalFile: : Next: out2 ")); At the end of the//
# endif


Has a problem, added some information before and after the function display, and then locate the FindNextFile to return and the previous output in there, behind the output out of no,

CodePudding user response:

http://download.csdn.net/download/chenzhjlf/2485790
Look at this, look to help ~
  • Related