mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
43 lines
1.0 KiB
Fortran
43 lines
1.0 KiB
Fortran
!****************************************************************
|
|
!***
|
|
!*** This file belongs with the course
|
|
!*** Introduction to Scientific Programming in C++/Fortran2003
|
|
!*** copyright 2017-2022 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
!***
|
|
!*** readwrite.F90 : string conversions
|
|
!***
|
|
!****************************************************************
|
|
|
|
Program ReadWrite
|
|
implicit none
|
|
|
|
!!codesnippet flongdate
|
|
character(len=10) :: longdate
|
|
!!codesnippet end
|
|
|
|
!!codesnippet fdatestr
|
|
character(len=8) :: date
|
|
integer :: year,month,day
|
|
date = "20221027"
|
|
read( date,'( i4,i2,i2 )' ) &
|
|
year,month,day
|
|
!!codesnippet end
|
|
print *,"RW"
|
|
!!codesnippet fdatestr
|
|
print *,"Date:",date
|
|
print '( "Year=",i4,", mo=",i2,", day=",i2 )', &
|
|
year,month,day
|
|
!!codesnippet end
|
|
print *,"rw"
|
|
|
|
print *,"Slash"
|
|
!!codesnippet flongdate
|
|
write( longdate,&
|
|
'( i4,"/",i2,"/",i2 )' &
|
|
) year,month,day
|
|
print *,"Long date:",longdate
|
|
!!codesnippet end
|
|
print *,"slash"
|
|
|
|
end Program ReadWrite
|