About filesysytem...

This is a discussion on About filesysytem... within the Linux Programming forums, part of the Platform Specific Boards category; Hi, all... I'm a new comer in this forum and I also a newbie in linux world. I'm a student. ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    1

    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

    arguments:
    -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...
    Thanx...

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    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!
    CornedBee

    "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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,687
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21