fstat

  • The PHP function fstat works the same as stat, only it takes an open stream resource as its input instead of a filename.

    PHP

    $f = fopen('/path/to/foobar', 'r');
    $stat = fstat($f);
    fclose($f)
     
    print $stat['ino'];
    //=> 16793883

    For an open file in Ruby, you can call the File#stat instance method.

    Ruby

    f = File.open('/path/to/foobar', 'r')
    stat = f.stat
    f.close
     
    p stat.ino
    #=> 16793883

    see also

fseek ftell

Looking for Rails or PHP web application development, integration, and training?

Rails for PHP is brought to you by Maintainable Software. Get custom web applications and personalized training from the authors of the book and website.