Difference between revisions of "Manual:DIL Manual/filesize()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="bffilesize"></span>
+
= filesize() =
 +
'''Obsolete.''' DIL has no function <code>filesize()</code>; vmc doesn't know the name, and nothing replaces it.
  
−
'''Function:'''  <i><!--CODE-->integer filesize ( filename :string);</i><!--ENDCODE-->
+
To see whether a file saved with <code>savestr()</code> exists, read it with [[Manual:DIL Manual/loadstr()|loadstr()]], which tells whether it could be read, and take its length with [[Manual:DIL Manual/length()|length()]].
−
 
 
−
<!--TERM-->  '''file'''
 
−
<!--DEFINITION-->        The file name you want to check
 
−
<!--TERM-->  '''return'''
 
−
<!--DEFINITION-->         a file size in bites 0 if no file
 
−
 
 
−
 
 
−
 
 
−
 
 
−
This function does exactly what it says it does it checks a files size.
 
−
 
 
−
'''Example DIL:'''
 
−
<i><!--CODE-->
 
−
---~---~---~---~---~---~---~---~---
 
−
 
 
−
dilbegin notebook ();
 
−
code
 
−
dilend
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 
−
 
 
−
</i><!--ENDCODE-->
 
−
The previous DIL example shows how you could use the 'filesize' instruction to
 
−
check the size of a player stored notebook.
 
−
 
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 
−
<span id="bffilesize"></span>
 
−
 
 
−
'''Function:'''  <i><!--CODE-->integer filesize ( filename :string);</i><!--ENDCODE-->
 
−
 
 
−
<!--TERM-->  '''file'''
 
−
<!--DEFINITION-->        The file name you want to check
 
−
<!--TERM-->  '''return'''
 
−
<!--DEFINITION-->        a file size in bites 0 if no file
 
−
 
 
−
 
 
−
 
 
−
 
 
−
This function does exactly what it says it does it checks a files size.
 
−
 
 
−
'''Example DIL:'''
 
−
<i><!--CODE-->
 
−
---~---~---~---~---~---~---~---~---
 
−
 
 
−
dilbegin notebook ();
 
−
code
 
−
dilend
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 
−
 
 
−
</i><!--ENDCODE-->
 
−
The previous DIL example shows how you could use the 'filesize' instruction to
 
−
check the size of a player stored notebook.
 
−
 
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 

Latest revision as of 23:25, 14 November 2026

filesize()

Obsolete. DIL has no function filesize(); vmc doesn't know the name, and nothing replaces it.

To see whether a file saved with savestr() exists, read it with loadstr(), which tells whether it could be read, and take its length with length().