integer :: i !ファイル名に入れたい変数
character :: filename*20
!なんかの処理
write(filename,*) i !i->filename 変換
!read(filename,*) i !ちなみに逆変換も可能
filename='output_'//trim(adjustl(filename))//'.dat' !adjustlで左寄せにしてからtrimで末尾の空白除去,拡張子等をくっつける
print *, filename !表示してみる
open(20,file=filename, status='replace') !使う
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme