Nasal library/io: Difference between revisions

Jump to navigation Jump to search
→‎Functions: Start stat()
m (→‎Variables: typos)
(→‎Functions: Start stat())
Line 296: Line 296:
}}
}}


=== stat(filename) ===
=== stat() ===
Calls unix or win32 stat() on the specified file name and returns a seven element array whose contents are, in order: dev, ino, mode, nlink, uid, gid, rdef, size, atime, mtime, ctime. Errors are signaled as exceptions as per die().
{{Nasal doc
|syntax = io.stat(path);
|text = Calls {{func link|stat()|ext=https://en.wikipedia.org/wiki/Stat_(system_call)}} and returns an array containing 12 pieces of data. See the table below.
|param1 = path
|param1text = Path to the file as a string.
|example1 = var path = getprop("/sim/fg-root") ~ '/Nasal/geo.nas';
var stat = io.stat(path);
printf("File size: %s bytes", stat[7]); # prints file size
}}
 
{| class="wikitable"
! Data !! Meaning
|}


=== tell(filehandle) ===
=== tell(filehandle) ===

Navigation menu