Thread: file management in c

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    15

    file management in c

    hey guys, i m studying file management in c and i wanted to know the
    reference material and tutorials in files ,kindly help.post links related to files.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Did you look in your compiler's documentation?

    Seriously... the C library docs, man pages, help files, that came with your compiler should lay out the whole thing for you. (the whole language, in fact)

    C's file management capabilities are (at best) non existent. You can open files, close files, delete files, and not much more... Some libraries include a rename function... very few allow you to enumerate files in directories or find files. If you want to copy a file, you get to write the code yourself... etc.

    The real guts of decent file management will come from your Operating System's API (Application Programming Interface) and will be specific to each OS...

    So what exactly are you trying to do?

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    As Tater says, file management in C is mostly OS specific, so you will need to tell us what OS this is for.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User
    Join Date
    Aug 2011
    Posts
    15
    i m currently programming on fedora11 using gcc.

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Animesh Gaitond View Post
    i m currently programming on fedora11 using gcc.
    File System Interface - The GNU C Library

    See esp. the section on "File Attributes", which explains how to use stat(). Stat() returns a "struct stat" for a file, which contains a bunch of information. There is a also a "struct dirent" (dirent = directory entry) which contains some other information (such as the file type), to get that you must use readdir(), which is described in the section "Accessing Directories".

    Glibc (the GNU C library, which is the C library on linux) also has build-in versions of chmod and chown so you do not have to use system() or some such. They're listed in the reference manual index:

    Function Index - The GNU C Library
    Last edited by MK27; 09-20-2011 at 10:34 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File Management in C
    By Figen in forum C Programming
    Replies: 6
    Last Post: 01-31-2011, 03:14 PM
  2. need help for file management
    By edesign in forum C Programming
    Replies: 5
    Last Post: 02-08-2008, 11:29 PM
  3. File/directory management
    By geek in forum C Programming
    Replies: 2
    Last Post: 04-25-2006, 08:49 PM
  4. File Management :: Win32
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 12-13-2002, 05:35 PM