Skip to content

Instantly share code, notes, and snippets.

@Unlimiter Unlimiter/move.c
Last active May 24, 2019

What would you like to do?
Fast function for moving files.
* Fast function for moving files.
* — Unlimiter
// This function has been tested with '' which has the size of 6488666 bytes, and the execution time was very close to null.
// At that point, it is very comparable to the 'mv' command on Linux.
void move(char* src_path, char* dest_path) {
#include <stdio.h>
FILE* src = fopen(src_path, "rb");
FILE* dest = fopen(dest_path, "wb");
fseek(src, 0, SEEK_END);
unsigned long long src_size = ftell(src);
char* buf;
fread(buf, 1, src_size, src);
fwrite(buf, 1, src_size, dest);
// Uncomment the main function for testing through the command line.
int main(int argc, char** argv) {
if (argc > 2) {
move(argv[1], argv[2]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.