This language bar is your friend. Select your favorite languages!
Select your favorite languages :
- Or search :
- Ada
- C
- C
- C++
- C#
- C#
- D
- Dart
- Dart
- Elixir
- Fortran
- Go
- Haskell
- JS
- Java
- Lisp
- PHP
- Pascal
- Perl
- Python
- Ruby
- Rust
- Rust
- Rust
struct stat st;
if (stat (path &st) == 0) x = st.st_size;
POSIX function stat avoids opening the file
program xx
implicit none
character(len=256) :: message
character(len=4096) :: filename
integer :: ios,x
logical :: foundit
filename='myfile'
inquire(file=filename,exist=foundit,size=x,iostat=ios,iomsg=message)
if(.not.foundit)then
write(*,*)'file ',trim(filename),' not found'
elseif(ios.ne.0)then
write(*,*)trim(message)
else
write(*,*)'size =',x,'bytes'
endif
end program xx
programming-idioms.org