[HELP] Changing file directory
#1

Hey guys.

I have a problem and I do not know how to solve it.
It's about moving files to another directory.
for example:

move file: cars/owned/car101.txt
to: cars/free/car101.txt

Can someone give me function, callback or something please?

I really need this!
Reply
#2

pawn Код:
stock fcopytextfile(oldname[],newname[])
{
    new File:ohnd,File:nhnd;
    if (!fexist(oldname)) return 0;
    ohnd=fopen(oldname,io_read);
    nhnd=fopen(newname,io_write);
    new tmpres[256];
    while (fread(ohnd,tmpres))
    {
        fwrite(nhnd,tmpres);
    }
    fclose(ohnd);
    fclose(nhnd);
    return 1;
}
pawn Код:
fcopytextfile("cars/owned/car101.txt", "cars/free/car101.txt");
This will make a copy. Use fremove to remove the old file.
Reply
#3

Sorry, solved before.
i have own code:
Код:
stock dini_Move(filename[], destination[])
{
   dini_Create(destination);
new string[256], File:From = fopen(filename, io_read), File:To = fopen(destination, io_append);
while(fread(From, string))
{
    format(string, sizeof(string), "%s\r\n", string);
    fwrite(To, string);
 }
dini_Remove(filename);
}
Lock!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)