How can I check a folder to see if there is a specific file exist or not?
-
Dear All, I am a new comer of this message board. First let me say hi to you all ^_^ I am working on my project in my school which require me to check if there is any new file exist in a folder by using MFC. Since I am just start learning MFC a few weeks before, I totally have no idea about how I can do so........ Would anyone give me some advice on this in details? Really thanks a lot! Yours, Meteor
-
Dear All, I am a new comer of this message board. First let me say hi to you all ^_^ I am working on my project in my school which require me to check if there is any new file exist in a folder by using MFC. Since I am just start learning MFC a few weeks before, I totally have no idea about how I can do so........ Would anyone give me some advice on this in details? Really thanks a lot! Yours, Meteor
Hi, CFile f; char* pFileName = "test.dat"; if( !f.Open( pFileName, CFile::modeRead | CFile::shareDenyNone ) ) { #ifdef _DEBUG afxDump << "File could not be opened " << "\n"; #endif } Sincerely Yours, RadioShark
-
Dear All, I am a new comer of this message board. First let me say hi to you all ^_^ I am working on my project in my school which require me to check if there is any new file exist in a folder by using MFC. Since I am just start learning MFC a few weeks before, I totally have no idea about how I can do so........ Would anyone give me some advice on this in details? Really thanks a lot! Yours, Meteor
How about
_access()
, orCFile::GetStatus()
?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
Hi, CFile f; char* pFileName = "test.dat"; if( !f.Open( pFileName, CFile::modeRead | CFile::shareDenyNone ) ) { #ifdef _DEBUG afxDump << "File could not be opened " << "\n"; #endif } Sincerely Yours, RadioShark
Oh....I forget to mention that I have to check it continuously, i.e. when I start the program, I have to be able to check it after clicking "Start" button and it will loop continuously to check..... Will your method be ok on that also? ^_^ Yours, Meteor
-
Oh....I forget to mention that I have to check it continuously, i.e. when I start the program, I have to be able to check it after clicking "Start" button and it will loop continuously to check..... Will your method be ok on that also? ^_^ Yours, Meteor
StarMeteor wrote: ...and it will loop continuously to check... If that is your requirement, use
ReadDirectoryChangesW()
and/orFindFirstChangeNotification()
instead. Unless it is done infrequently, polling the OS in a loop is not very efficicent.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
StarMeteor wrote: ...and it will loop continuously to check... If that is your requirement, use
ReadDirectoryChangesW()
and/orFindFirstChangeNotification()
instead. Unless it is done infrequently, polling the OS in a loop is not very efficicent.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
Oh.....actually I have looked in this site and read an article about the API you mentioned...but I don't understand it much....especially what I need to use it and how to initialize ..... :sigh:T_T
-
Oh.....actually I have looked in this site and read an article about the API you mentioned...but I don't understand it much....especially what I need to use it and how to initialize ..... :sigh:T_T
fwatch.exe is a good example.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
fwatch.exe is a good example.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
Oh...I found that I forget to defind #define _WIN32_WINNT 0x400 at stdafx.h in order to use the API.... I can use it now! Thanks a lot~