Create file.inc
Browse files
file.inc
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* File input/output functions
|
| 2 |
+
*
|
| 3 |
+
* (c) Copyright 2004-2005, ITB CompuPhase
|
| 4 |
+
* This file is provided as is (no warranties).
|
| 5 |
+
*/
|
| 6 |
+
#if defined _file_included
|
| 7 |
+
#endinput
|
| 8 |
+
#endif
|
| 9 |
+
#define _file_included
|
| 10 |
+
#pragma library File
|
| 11 |
+
|
| 12 |
+
enum filemode
|
| 13 |
+
{
|
| 14 |
+
io_read, /* file must exist */
|
| 15 |
+
io_write, /* creates a new file */
|
| 16 |
+
io_readwrite, /* opens an existing file, or creates a new file */
|
| 17 |
+
io_append, /* appends to file (write-only) */
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
enum seek_whence
|
| 21 |
+
{
|
| 22 |
+
seek_start,
|
| 23 |
+
seek_current,
|
| 24 |
+
seek_end,
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
const EOF = -1;
|
| 28 |
+
|
| 29 |
+
native File:fopen(const name[], filemode: mode = io_readwrite);
|
| 30 |
+
native bool:fclose(File: handle);
|
| 31 |
+
native File:ftemp();
|
| 32 |
+
native bool:fremove(const name[]);
|
| 33 |
+
|
| 34 |
+
native fwrite(File: handle, const string[]);
|
| 35 |
+
native fread(File: handle, string[], size = sizeof string, bool: pack = false);
|
| 36 |
+
native bool:fputchar(File: handle, value, bool: utf8 = true);
|
| 37 |
+
native fgetchar(File: handle, value, bool: utf8 = true);
|
| 38 |
+
native fblockwrite(File: handle, const buffer[], size = sizeof buffer);
|
| 39 |
+
native fblockread(File: handle, buffer[], size = sizeof buffer);
|
| 40 |
+
|
| 41 |
+
native fseek(File: handle, position = 0, seek_whence: whence = seek_start);
|
| 42 |
+
native flength(File: handle);
|
| 43 |
+
native fexist(const pattern[]);
|
| 44 |
+
native bool:fmatch(name[], const pattern[], index = 0, size = sizeof name);
|