Raised This Month: $ Target: $400
 0% 

Suggestion for file func


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
johnjg75
Veteran Member
Join Date: Mar 2004
Location: Delaware
Old 04-04-2005 , 19:15   Suggestion for file func
Reply With Quote #1

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.
__________________
johnjg75 is offline
Send a message via AIM to johnjg75 Send a message via MSN to johnjg75 Send a message via Yahoo to johnjg75
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode