Results 1 to 4 of 4

Thread: [SOLVED] C++ Gather File Information

  1. #1
    Join Date
    Jun 2008
    Beans
    93

    [SOLVED] C++ Gather File Information

    I am looking for a way to gather information about a given file/directory using C++ in linux. Essentially, I want to emulate at least some of the functionality of the File object in Java. I'd like to limit the amount of system() calls to a minimum (0 preferred).

    Little background: I'm making a file browser and I'd like to be able to get information about a file other than its name.

  2. #2
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,245
    Distro
    Kubuntu

    Re: C++ Gather File Information

    Read the man-pages on these C library functions:
    • opendir()
    • readdir()
    • closedir()
    • stat()

  3. #3
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: C++ Gather File Information

    To determine the file type you can use libmagic, which is the library the file command uses. Install libmagic-dev and read the manpage libmagic(3).

  4. #4
    Join Date
    Jun 2008
    Beans
    93

    Re: C++ Gather File Information

    Ok, thanks for the help.

Tags for this Thread

Bookmarks

Posting Permissions

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