Check, if mounted devices
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Check, if mounted devices

  1. #1
    Join Date
    Apr 2002
    Location
    Germany, Bavaria
    Posts
    36

    Check, if mounted devices

    Hi,

    how can I check a directory, if it's on a mounted device or local?
    Is there any c standard function?
    It should be portable to differnt unix archs.
    (Solaris, Solaris64, Solaris86, Tru64, HP1x, AIX, Linux, ......)

    Thanks,

    Marco

  2. #2
    Join Date
    Jan 2004
    Location
    Düsseldorf, Germany
    Posts
    2,401
    The statvfs system call gives you information about the filesystem a file resides on. It's POSIX, so it should be portable, but I don't take guarantee for it.

  3. #3
    Join Date
    Apr 2002
    Location
    Germany, Bavaria
    Posts
    36
    Okay thanks!
    I will try it with this one!

    Marco

  4. #4
    Join Date
    Jan 2004
    Location
    Düsseldorf, Germany
    Posts
    2,401
    Just noticed that my answer was somewhat incomplete.

    On Solaris, you can tell the filesystem by the f_basetype string and then have to use a table to decide if it is local or not (e.g. UFS = local, NFS = not). On other OSes you might not have f_basetype. So I don't think there is a really portable way.

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