<dirent.h> on MSVC
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: <dirent.h> on MSVC

  1. #1
    Join Date
    Nov 2002
    Location
    Sofia, Bulgaria
    Posts
    661

    Exclamation <dirent.h> on MSVC

    I have a code that I need to compile and it uses the functions and structs defined in <dirent.h>
    I found out that this is not a msvc standard header but I need to use msvc (for other stuff in the project).
    So I searched in the internet a lot and could only find the file but now I need to find a .lib or .obj file that contains the functions bodies, and unfortunately I cannot...

    Can someone please tell be where I can find this!

    thanx a lot for any help
    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,062
    I don't think that's available, but replace the function you need from dirent.h with the equivalents in the Win32 API.

    What functions do you use from dirent.h?

  3. #3
    Join Date
    Apr 1999
    Posts
    27,446

    Re: <dirent.h> on MSVC

    Originally posted by SeventhStar
    I have a code that I need to compile and it uses the functions and structs defined in <dirent.h>
    I found out that this is not a msvc standard header but I need to use msvc (for other stuff in the project).
    So I searched in the internet a lot and could only find the file but now I need to find a .lib or .obj file that contains the functions bodies, and unfortunately I cannot...
    Forget about trying to find a "dirent.h" for MSVC and just concentrate on the functions that you're trying to call. It's all part of porting your code to another compiler.

    You may never find a header file or lib file to call your functions exactly as before, so you use the functions that are available that mimic or closely resembles what the other functions did.

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Nov 2003
    Location
    Vienna, Austria
    Posts
    212
    dirent.h is part of POSIX, so it's quite unlikely you'll ever find it on Windows, except if you use some POSIX port like Cygwin.

    For platform-independent directory and path handling, use the Boost Filesystem library from www.boost.org
    All the buzzt
    CornedBee

  5. #5
    Join Date
    Oct 2002
    Location
    Singapore
    Posts
    3,128
    The equivalent functions in MS are _findfirst(), _findnext() and _findclose().

  6. #6
    Join Date
    Nov 2002
    Location
    Sofia, Bulgaria
    Posts
    661
    DJGPP and DEV C++ are both windows compilers and both have dirent.h so it does exist for windows

    Also are you sure that nobody has ever written a shell to _findfirst(), _findnext() and _findclose() functions that looks just like dirent.h just to make his UNIX and POSIX programs compile without change under windows
    (I see someone has done it for windows gnu c compilers but has nobody done it for windows?)

    If noone has, it sure will be easier for me to write it than change the code that I already have because, as I said, it's a LOT!
    Last edited by SeventhStar; November 21st, 2003 at 03:21 AM.
    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames

  7. #7
    Join Date
    Nov 2003
    Location
    Vienna, Austria
    Posts
    212
    Both DJGPP and MingW (the compiler used in Dev-C++) are ports of GCC to Windows and thus include a port of POSIX functions.

    The problem is that most ports of POSIX functions to Windows are probably done by people who come from Linux, and thus are likely to be licensed under the GPL. Don't forget: if you use that code your app must be released under the GPL too!

    Don't know about MingW's port though, maybe it has an easier license (would make sense in a way). Maybe you can use theirs (or adapt theirs so you can use it).
    All the buzzt
    CornedBee

  8. #8
    Join Date
    Nov 2002
    Location
    Sofia, Bulgaria
    Posts
    661
    the problem is that I want these functions written for msc
    i need a .lib file with them or at least their sources

    i dont have the sources of these compilers
    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames

  9. #9
    Join Date
    Nov 2003
    Location
    Vienna, Austria
    Posts
    212
    But you can get them.
    All the buzzt
    CornedBee

  10. #10
    Join Date
    Nov 2002
    Location
    Sofia, Bulgaria
    Posts
    661
    nevermind...
    i re-wrote the functionallity i needed it took me several hours and i'm fine now

    thanx for the help
    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center