Thread: About filesysytem...

  1. #1
    Registered User
    Join Date
    Dec 2006

    About filesysytem...

    Hi, all...

    I'm a new comer in this forum and I also a newbie in linux world. I'm a student. So, i hope

    i'll get more knowledge here.

    Okay, here is my first post (and my first problem too :P )

    Yesterday, my lecturer give me assignment about file system chapter. He asked me to make a

    program with gcc that simulate an "ls-like" command. I mean, i'm asked to make a program

    that can display the contents of a directory (maybe files or other directories). And the

    program can also recieve arguments, such as:
    -a to display all of contents, including the hiding ones
    -l to display in a list views
    -R to display recursively (display the contents of it's subdirectories too)
    -d to display only the directory type content (subdirectory)

    The second problem:
    I'm asked to make a program with gcc that can display the contents of a file, with

    -c(n) to display in column views (n is the number of column)
    -t(h|d) to display in h=hexa or d=decimal

    Phew...can you imagine my frustated? So, anybody help me please...

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Um ...

    C or C++?

    We don't do your homework. What's your approach? What's your specific problem? What code have you already written?
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    opendir ( ) / readdir ( ) / closedir ()
    To get all the files in a directory

    stat() to get extended information on a file, like its permissions, size 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.

Popular pages Recent additions subscribe to a feed