Hey, i was going to put this in my module, but i figured it'd be better to just add it to amxx if you wish. It's just a simple file copy function which is much easier than using the file funcs you have now. I was thinking of using it for a file backup plugin or something.
Now, i haven't tested it so tell me if there are any errors and it is just a suggestion and tell me if you'll put it in or not.
Here's the code:
Code:
#include <string.h>
#include <new>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <fstream.h>
#include "amxxmodule.h"
static cell AMX_NATIVE_CALL file_copy(AMX *amx, cell *params) // file_copy(source,dest) 2 Parameters
{
ifstream OpenFile(params[1]);
fstream File(params[2]);
char ch[512];
while(!OpenFile.eof())
{
OpenFile.getline(ch,511);
File << ch << endl;
}
return 1;
}
It looks good to me but tell me if something is wrong. Thanks.
__________________