Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stat($filename) , Cant get to work , Frustrated

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
The "random.txt" file resides in the same folder as the function call.
-------------------RESULT------------------------------
$device is :
$ino is :
$mode is :
$nlink is :
$uid is :
-------------------SCRIPT-----------------------------

open (INFILE, "random.txt") or die ("error");

($device,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat(random.txt);

close INFILE;
print('$device is :'.$device."\n");
print('$ino is :'.$ino ."\n");
print('$mode is :'.$mode."\n");
print('$nlink is :'.$nlink."\n");
print('$uid is :'.$uid."\n");
 
Try this.... put the argument to stat in quotes.

($device,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat("./random.txt");


Also, I think you are confused with the [red]open...stat....close[/red] series of operations. You do not need to do an open to do the stat. And, opening the file will cause changes in the info you get back from stat.

HTH


keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top