# File manipulation

This is a discussion on File manipulation within the C Programming forums, part of the General Programming Boards category; Ok, so through google, and some information at this site, I have gathered up quite a few things, and am ...

1. ## File manipulation

Ok, so through google, and some information at this site, I have gathered up quite a few things, and am about to set off on a console application. I didn't seem to turn up much about file manipulation...? I found information on remove. This just removes a file though. This will be helpful ( instead of using all system calls *yuck* ), but I was wondering where you could find, or how you do file manipulation in c without using system calls.

In Visual C++ it would be:

Code:
CopyFile("c:\\source\\of\\file.ext", "c:\\destination\\of\\file.ext", NULL);
DeleteFile("c:\\path\\to\\file.ext"); // remove does this though
MoveFile("c:\\current\\location.ext, "c:\\new\\location.ext");

2. Strictly in ANSI C, you would have to work a bit more:

>CopyFile("c:\\source\\of\\file.ext", "c:\\destination\\of\\file.ext", NULL);
Open two files, one for reading and one for writing. The one you read from is the source file and the one you write to is the destination file. Manually transfer the data from one file to the next.

>MoveFile("c:\\current\\location.ext, "c:\\new\\location.ext");
Same as above except open the destination file at the new location.

-Prelude