Go to the documentation of this file.00001
00003
00016 module mod_utility
00017 #include "fml_constants.h"
00018 use mod_exception
00019 implicit none
00020
00023 character(len=len_what_exception) :: u_what_exception
00024 CONTAINS
00025
00033 function u_is_exist_file(filename) result(res)
00034 character*(*), intent(in) :: filename
00035
00036 type(type_exception) :: err_exception;
00037 logical :: res
00038
00039 inquire(file=filename, exist=res)
00040 #ifdef DEBUG_EXCEPTION
00041 if(.not.res) then
00042 u_what_exception='u_is_exist_file::'//filename//' not exist'
00043 err_exception=e_error(stop_open_file,u_what_exception,stop_open_file)
00044 end if
00045 #endif
00046 end function u_is_exist_file
00047
00055 function u_nbline(filename) result(res)
00056 character*(*), intent(in) :: filename
00057
00058 integer :: res
00059 integer :: i
00060 character :: var(10)
00061
00062 if(u_is_exist_file(filename)) then
00063 open(10, file=filename)
00064 i=0
00065 do
00066 read(10,*,end=1000)
00067 i = i + 1
00068 end do
00069 1000 res=i
00070 close(unit=10)
00071 end if
00072 end function u_nbline
00073
00074
00075 end module mod_utility