Fexist
From SA-MP Wiki
(Difference between revisions)
Revision as of 05:24, 9 April 2013 Smithy (Talk | contribs) ← Previous diff |
Revision as of 23:28, 31 January 2014 Connor Mead (Talk | contribs) Next diff → |
||
Line 1: | Line 1: | ||
{{Scripting}} | {{Scripting}} | ||
- | {{Title}} | ||
{{Description|Checks if a specific file exists in the scriptfiles directory.}} | {{Description|Checks if a specific file exists in the scriptfiles directory.}} | ||
Line 33: | Line 32: | ||
[[Category:Scripting Functions]] | [[Category:Scripting Functions]] | ||
[[Category:File Functions]] | [[Category:File Functions]] | ||
+ | |||
+ | [[fr:Fexist]] |
Revision as of 23:28, 31 January 2014
Description:
Checks if a specific file exists in the scriptfiles directory.
(const pattern[])
pattern[] | The name of the file, optionally containing wild-card characters. |
Return Values:
The number of files that match the pattern.
if(!fexist("myfile.txt")) { print("Your file does not exist"); } else { //If you open a file that does not exist, the server will create it. new File:fhandle = fopen("myfile.txt",io_append); if(fhandle) { fwrite(fhandle,"mytext"); fclose(fhandle); } }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- fopen: Open a file.
- fclose: Close a file.