Write file with specified name
#2

There is no CreateFile function unfortunately. However, you can simply open the file in io_write mode and instantly close it, which will create the file.

pawn Код:
CMD:file(playerid, params[]) {

    if(isnull(params) || !strfind(params, ".")) {
        // invalid file format or no params entered
        // this is a VERY shitty way of checking, so
        // I highly suggest expanding this check to
        // include already existed file names,
        // spaces, invalid characters, etc.
    } else {
        new File: hFile = fopen(params, io_write);
        fclose(hFile);
    }
    return 1;
}
As explained in the code, the file check is VERY basic. Expand on it in case of improper input.
Reply


Messages In This Thread
Write file with specified name - by nickbouwhuis - 30.10.2012, 20:24
Re: Write file with specified name - by Bakr - 30.10.2012, 21:26

Forum Jump:


Users browsing this thread: 1 Guest(s)