Home > Archive > C > February 2006 > problems in file handling
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
problems in file handling
|
|
|
| can i make my own file rename, delete functions. if it is the how it
is possible
help me
| |
| Nick Keighley 2006-02-25, 6:55 pm |
| ashu wrote:
> can i make my own file rename, delete functions. if it is the how it
> is possible
> help me
why would you want to do this? In principal, yes you could do this but
it very platform specific. You'd need to go to a platform specific
group
(Win32 or Unix etc.) access the file system. Or write your own file
system (not to be recomended as a first programming excercise! :-)
--
Nick Keighley
My god it's full of stars!
Dave Bowman, on seeing HAL's source code
My god it's full of mouse ****!
An engineer diagnosing a faulty processor
| |
| Ben Pfaff 2006-02-25, 6:55 pm |
| "ashu" <riskyashish@yahoo.com> writes:
> can i make my own file rename, delete functions. if it is the how it
> is possible
There are already standard functions rename() and remove() that
will rename and delete files.
--
int main(void){char p[]=" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn
opqrstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
| |
| Jordan Abel 2006-02-25, 6:55 pm |
| On 2006-02-25, Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:
> ashu wrote:
>
>
> why would you want to do this? In principal, yes you could do this but
> it very platform specific. You'd need to go to a platform specific
> group
> (Win32 or Unix etc.) access the file system. Or write your own file
> system (not to be recomended as a first programming excercise! :-)
Or write it in terms of rename() [is that standard C? if not, you could
copy and delete] and remove().
| |
| Malcolm 2006-02-26, 6:55 pm |
| "ashu" <riskyashish@yahoo.com> wrote
>
> can i make my own file rename, delete functions. if it is the how it
> is possible
> help me
>
Normally you would implement these functions by calling platform-specific
code provided by the creators of the operating system.
If you want to build a file system yourself it is very difficult. You have
to know how files are laid out on disk, and how to address the disk
controller at a low level to mark files as deleted, change the name, and so
on.
>
--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $6.90 paper, available www.lulu.com
|
|
|
|
|