How distinguish folders between files

CFile::GetStatus function can not distinguish
folders between files. I wanna
consider a file as a inexisting path (or folders) .
Because I want to send some files to the folder,
sending a file to file will turn to a ERROR.
How can I get the above purpose?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are you saying CFile::GetStatus can't distinguish between, for example,
This is what you you need to do.

After CFile::GetStatus(lpszFileName, rStatus) function call to get the status of the file

The second parameter to the function is the CFileStatus which contains a variable BYTE m_attribute :  The attribute byte of the file.

The m_attribute is the file attribute. The Microsoft Foundation classes provide an enum type attribute so that you can specify attributes symbolically:

enum Attribute {
   normal =    0x00,
   readOnly =  0x01,
   hidden =    0x02,
   system =    0x04,
   volume =    0x08,
   directory = 0x10,
   archive =   0x20

check if the File is a directory by comparing
if(rStatus->m_attribute && 0x10)
  // this is a directory

Hope this is what you needed


Feel free to ask queries.
My mail id is

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The correct code to abdij's solutions is-

if(rStatus->m_attribute & 0x10)
  // this is a directory

SampsonC is correct.  (Remember, && is logical and; & is bitwise and.)

However, you should use the enumerated Attribute(symbolic name) "directory" instead of the magic number "0x10".
henry3Author Commented:
Thanks abdij, and everyone giving comments!
I got a perfect answer to my qestion.
But I think
  "rStatus->m_attribute & 0x10"
should be
  "rStatus.m_attribute & 0x10".
Is that right?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.