[Plugin] FileFunctions v0.1b
#1

FileFunctions v0.1b

This plugin allows you to manage files. There are some interresting features:
  • Lots of functions
  • More filemodes available
  • Slightly faster than SA-MP I/O
  • Allows you to manage files not only limited in 'scriptfiles' but over your whole server directory (starting from the root)
  • Usage is very similar and working is exact the same like SA:MP I/O
  • Using a 'File' tag for file index.
  • ...
Natives
  • File: fileOpen(const fileName[], io_FileMode: fileMode);
    • Opens a file.
    • If the file has been succesfully opened the function will return a pointer to a file object that is used to identify the handle on all further operations involving it. Otherwise, a null pointer is returned.
  • File: fileReOpen(File: handle, const fileName[], io_FileMode: fileMode);
    • Reopens a file.
    • If the file was succesfully reopened, the function returns a pointer to an object identifying the handle. Otherwise, a null pointer is returned.
  • fileClose(File: handle);
    • Closes a file.
    • If the handle is successfully closed, a zero value is returned. On failure, EOF (-1) is returned.
  • fileRemove(const fileName[]);
    • Removes a file.
    • If the file is successfully removed, a true value is returned. On failure, a null pointer is returned.
  • fileExists(const fileName[]);
    • Checks if a files exists.
    • If the file exists, a true value is returned. On failure, a null pointer is returned.
  • fileMove(const currentFilePath[], const newFilePath[]);
    • Moves a file. It can be used to rename a file too.
    • If the file is succesfully moved, a true value is returned. On failure, a null pointer is returned.
  • fileRewind(File: handle);
    • Sets the position indicator associated with handle to the beginning of the file.
    • If the file that has to be rewind exists, a true value is returned. On failure, a null pointer is returned.
  • fileWrite(File: handle, const string[]);
    • Writes the string to the current position of the handle.
    • The total number of elements successfully written is returned.
  • fileRead(File: handle, buffer[], const size = sizeof(buffer));
    • Reads the file starting from the current position of the handle and stores the data in the buffer. Reads line by line.
    • If reading is succesful, a true value will be returned. On failure, a null pointer is returned.
  • filePutChar(File: handle, value);
    • Writes a character to the handle and advances the position indicator.
    • If there are no errors, the same character that has been written is returned. On failure, EOF (-1) is returned.
  • fileGetChar(File: handle);
    • Returns the character currently pointed by the internal file position indicator of the specified handle.
    • If there are no errors, the character read is returned as an integer value. On failure, EOF (-1) is returned.
  • fileSeek(File: handle, position, seek_Origin: origin);
    • Sets the position indicator associated with the stream to a new position defined by adding offset to a reference position specified by origin.
    • If there are no errors, a true value is returned. Otherwise, a null pointer is returned.
  • fileLength(File: handle);
    • On success, the current value of the position indicator is returned.
    • If there are no errors, the size of the file will return in bytes. On failure, EOF (-1) is returned.
Changelog

0.1b:
- Initial release.

Download

Download (Source + Include + .dll) (Windows)
Download (Source + .so) (Linux)

Note(s)

- You must have Microsoft .NET Framework 4 installed to run this.
- This is a beta version and may contain bugs. Please report if you find one.
- Credits go to this site where I got many useful information from.
Reply


Messages In This Thread
FileFunctions v0.1b - by RyDeR` - 03.05.2011, 17:49
Re: FileFunctions v0.1b - by CJ101 - 03.05.2011, 17:54
Re: FileFunctions v0.1b - by Zh3r0 - 03.05.2011, 18:49
Re: FileFunctions v0.1b - by fissekarl - 03.05.2011, 19:00
Re: FileFunctions v0.1b - by 1337connor - 03.05.2011, 19:06
Re: FileFunctions v0.1b - by RyDeR` - 03.05.2011, 19:08
Re: FileFunctions v0.1b - by GaGlets(R) - 03.05.2011, 19:15
Re: FileFunctions v0.1b - by Ricop522 - 03.05.2011, 19:32
Re: FileFunctions v0.1b - by =WoR=Varth - 03.05.2011, 19:40
Re: FileFunctions v0.1b - by Calgon - 03.05.2011, 19:57
Re: FileFunctions v0.1b - by 1337connor - 03.05.2011, 20:57
Re: FileFunctions v0.1b - by RyDeR` - 03.05.2011, 20:59
Re: FileFunctions v0.1b - by Calgon - 03.05.2011, 21:31
Re: FileFunctions v0.1b - by serman - 04.05.2011, 02:16
Re: FileFunctions v0.1b - by QuaTTrO - 04.05.2011, 04:13
Re: FileFunctions v0.1b - by CookieCrusher - 04.05.2011, 08:30
Re: FileFunctions v0.1b - by RyDeR` - 04.05.2011, 10:09
Re: FileFunctions v0.1b - by [MWR]Blood - 04.05.2011, 10:22
Re: FileFunctions v0.1b - by xir - 04.05.2011, 13:44
Re: FileFunctions v0.1b - by xir - 05.05.2011, 15:37
Re: FileFunctions v0.1b - by RyDeR` - 05.05.2011, 15:47
Re: FileFunctions v0.1b - by xir - 05.05.2011, 15:49
Re: FileFunctions v0.1b - by SlashPT - 05.05.2011, 16:36
Re: FileFunctions v0.1b - by olaf137 - 05.05.2011, 16:42
Re: FileFunctions v0.1b - by JaTochNietDan - 05.05.2011, 17:35
Re: FileFunctions v0.1b - by RyDeR` - 05.05.2011, 17:37
Re: FileFunctions v0.1b - by Unknown1234 - 06.05.2011, 08:37
Re: FileFunctions v0.1b - by Calgon - 06.05.2011, 10:09
Re: FileFunctions v0.1b - by Unknown1234 - 06.05.2011, 10:19
Re: FileFunctions v0.1b - by fissekarl - 07.05.2011, 11:23
Re: FileFunctions v0.1b - by [RSL]KobRa - 08.05.2011, 13:40
AW: FileFunctions v0.1b - by Meta - 26.05.2011, 00:06
Re: FileFunctions v0.1b - by QuaTTrO - 19.06.2011, 07:37
Re: FileFunctions v0.1b - by RyDeR` - 19.06.2011, 08:28
Re: FileFunctions v0.1b - by GobL1N - 19.06.2011, 19:33
Re: FileFunctions v0.1b - by [BP]Tony - 22.06.2011, 10:28
Re: FileFunctions v0.1b - by FANEX - 04.07.2011, 18:49
Re: FileFunctions v0.1b - by langricr - 04.07.2011, 20:33
Re: FileFunctions v0.1b - by RyDeR` - 04.07.2011, 20:40
AW: FileFunctions v0.1b - by asdfgh98 - 16.07.2011, 18:49
Re: FileFunctions v0.1b - by Incubator - 17.07.2011, 12:46
Re: FileFunctions v0.1b - by RyDeR` - 17.07.2011, 13:57
Re: FileFunctions v0.1b - by Incubator - 17.07.2011, 14:32
Re: FileFunctions v0.1b - by RyDeR` - 21.07.2011, 08:49
Re: FileFunctions v0.1b - by RyDeR` - 06.08.2011, 17:52
Re: FileFunctions v0.1b - by Gamer_Z - 06.08.2011, 18:26
Re: FileFunctions v0.1b - by RyDeR` - 06.08.2011, 18:31
Re: FileFunctions v0.1b - by Gamer_Z - 06.08.2011, 18:38
Re: FileFunctions v0.1b - by stJ. - 06.08.2011, 20:16
Re: FileFunctions v0.1b - by MisterTickle - 21.08.2011, 15:51
Re: FileFunctions v0.1b - by Rewer[G] - 06.09.2011, 16:06
Re: FileFunctions v0.1b - by Patchwerk - 12.09.2011, 09:49
Re: FileFunctions v0.1b - by Patchwerk - 12.09.2011, 11:08
Re: FileFunctions v0.1b - by TheArcher - 12.09.2011, 12:24
Re: FileFunctions v0.1b - by Allan Kardec - 12.09.2011, 12:38
Re: FileFunctions v0.1b - by Ballu Miaa - 29.02.2012, 06:13
Re: FileFunctions v0.1b - by Niko_boy - 29.02.2012, 08:08
Re: FileFunctions v0.1b - by Romullo - 15.05.2013, 12:27
Re: FileFunctions v0.1b - by Dzines4SAMP - 15.05.2013, 12:30

Forum Jump:


Users browsing this thread: 1 Guest(s)