Thread: Portable C/C++ library containing filesystem interface

  1. #1
    Registered User
    Join Date
    Aug 2005

    Portable C/C++ library containing filesystem interface

    Hi everybody,

    I would like to know if anybody has some experience with portable libraries for manipulating files, directories and directory trees. I'm interested in operations such as creating, opening, reading, closing directories, applying actions to files in a directory tree or reading attributes of a file. Library should work under both Linux and Windows. Filesystem interface in glibc seems convenient for me, but I was unable to find native port of glibc for Windows. I've also checked documentation for SFL and I'm afriad it lacks tools for manipulating trees. Is there any other library which you would recommend or is there any other way how to implement these operations and keep them portable?

  2. #2
    Join Date
    Jun 2005
    devc++ can be foudn compiled for both windows and linux,

    and im not sure if we are on the same page but
    fopen can be used to open / edit / create files
    on any operating system that you can compile C on.

    but maybe that not what your looking for.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    fopen / fclose / etc for reading and writing files are ANSI-C functions, and are available everywhere.

    opendir / readdir / closedir are directory access functions within POSIX, which most modern OS's support to some extent.

    Another option to consider is using cygwin on the windows side to give you more of the unix feel to your programs.

    > or reading attributes of a file
    This will always be tricky, both have very different ideas on permissions, timestamps, access rights etc.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Nov 2002
    boost::filesystem provides an abstraction for dealing with the filesystem for POSIX and Win32. This is for C++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get RSSI value, send to sensor, sensor receive package, repackage it?
    By techissue2008 in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-04-2009, 10:13 AM
  2. Library Wrapper
    By cusavior in forum C Programming
    Replies: 3
    Last Post: 03-25-2008, 10:27 AM
  3. C++ Library Design
    By CornedBee in forum C++ Programming
    Replies: 2
    Last Post: 09-30-2004, 10:40 AM
  4. OOP in C
    By lyx in forum C Programming
    Replies: 4
    Last Post: 11-23-2003, 01:12 PM
  5. better c string functions
    By samps005 in forum C Programming
    Replies: 8
    Last Post: 11-04-2003, 01:28 PM