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.
Printable View
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.
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?
As Tater says, file management in C is mostly OS specific, so you will need to tell us what OS this is for.
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