SA-MP Forums Archive
[AJUDA] Renomear arquivo - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] Renomear arquivo (/showthread.php?tid=307265)



[AJUDA] Renomear arquivo - Kan - 29.12.2011

Tipo , tava criando um comando de alterar o nick do player, mais nгo sei qual a funзгo que renomeia o arquivo .ini para o novo nome do player :/
Alguem sabe qual a funзгo em dini que faz isso?


Re: [AJUDA] Renomear arquivo - Kuddy - 29.12.2011

Qual cache de salvamento vc ta usando


Re: [AJUDA] Renomear arquivo - Kan - 29.12.2011

Quote:
Originally Posted by dMagnus
Посмотреть сообщение
Qual cache de salvamento vc ta usando
Dini


Re: [AJUDA] Renomear arquivo - [S]trong - 29.12.2011

pawn Код:
frename(oldfile [], newfile []) // by [S]trong
{
    if (!fexist(oldfile))
    {
        return print("Error: Could file not found!");
    }

    new String [256],
        File: oldarchive = fopen(oldfile, io_read),
        File: newarchive = fopen(newfile, io_write);

    while (fread(oldarchive, String))
    {
        fwrite(newarchive, String);
    }
   
    fclose(newarchive);
    fclose(oldarchive);

    return fremove(oldfile);
}



Re: [AJUDA] Renomear arquivo - Kan - 29.12.2011

Quote:
Originally Posted by [S]trong
Посмотреть сообщение
pawn Код:
frename(oldfile [], newfile []) // by [S]trong
{
    if (!fexist(oldfile))
    {
        return print("Error: Could file not found!");
    }

    new String [256],
        File: oldarchive = fopen(oldfile, io_read),
        File: newarchive = fopen(newfile, io_write);

    while (fread(oldarchive, String))
    {
        fwrite(newarchive, String);
    }
   
    fclose(newarchive);
    fclose(oldarchive);

    return fremove(oldfile);
}
Ai eu uso assim?:

pawn Код:
frename(diretorio,tmp); //exemplo..



Re: [AJUDA] Renomear arquivo - [S]trong - 29.12.2011

Como eu nгo faзo a menor idйia do que as vбriaveis "diretorio" e "tmp" estгo armazenando vou postar da forma mais pura possнvel:
pawn Код:
frename(arquivoantigo, novoarquivo);