how to implement the CFileFind class in c++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bajajv
    New Member
    • Jun 2007
    • 152

    how to implement the CFileFind class in c++

    Hi,
    I was trying to implement the functions of CFileFind class in c++. Can anyone give some hint how it can be done? Didn't find anything relevant on the net.

    Thanks,
  • RRick
    Recognized Expert Contributor
    • Feb 2007
    • 463

    #2
    CFileFind is part of MFC and MFC is based on C++, isn't it?

    If you don't want to use MFC, some people suggest using the Windows API routines instead. These could be encapsulated in a C++, but you'll have to write it yourself. Try this link: https://"http://www.codeguru.com/for...php?t=372515"]

    Comment

    • bajajv
      New Member
      • Jun 2007
      • 152

      #3
      Originally posted by RRick
      CFileFind is part of MFC and MFC is based on C++, isn't it?

      If you don't want to use MFC, some people suggest using the Windows API routines instead.
      I dont want to use anything specific to any OS. Can we implement it such that it runs on every OS? Does c++ have something for this?

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        On, that is because different OS use different filing systems (in fact the same OS can use different filing systems) so there is no standard way to access the directory structure.

        Different OS do not even have the same method of specifying directories, i.e. Windows uses \ and Linux/Unix / as the directory separator. There is no standard way to enumerate directories/directory contents in C++ (or C).

        However if you are using C++ I would go and look at the boost libraries, I don't know if they have a solution but those guys have solved many problems of this nature.

        Comment

        • mac11
          Contributor
          • Apr 2007
          • 256

          #5
          Originally posted by Banfa
          I would go and look at the boost libraries, I don't know if they have a solution but those guys have solved many problems of this nature.
          Boost does indeed have a portable solution for filesystems.

          Comment

          • bajajv
            New Member
            • Jun 2007
            • 152

            #6
            Originally posted by mac11
            Boost does indeed have a portable solution for filesystems.
            http://www.boost.org/doc/libs/1_41_0.../doc/index.htm
            dont have the option of boost either. trying with opendir() and readdir().

            Comment

            • bajajv
              New Member
              • Jun 2007
              • 152

              #7
              hi,
              Can we implement the FindNextFile() function of CFile class from MFC by standard c++, (without using boost)? Any functions from standard c++ which will help in this case

              Comment

              Working...