in one of the question for beginners a program for moving a file was asked. i cud not find the algo can anyone suggest me the algo????????????

If you are using MS-Windows then you could call win32 api function CopyFile() to copy the file then delete the original. Otherwise, just write your own copy function to copy the file.

If you need to create your own copy function, first open the original file for reading, then create (or a file with that name exists) for writing. Then you could simply read a byte in the original file, then write that byte to the new file. This is simple to program, however very inefficient in terms of time if it is being copied to the same disk. A better solution might be to create a buffer (just an array of bytes), fill the buffer then write the buffer. Hope this helps.

This question has already been answered. Start a new discussion instead.