dcstringfprintf.f90
Go to the documentation of this file.
1 !== Formatted output conversion
2 !
3 ! Authors:: Yasuhiro MORIKAWA, Eizi TOYODA
4 ! Version:: $Id: dcstringfprintf.f90,v 1.2 2009-03-20 09:50:19 morikawa Exp $
5 ! Tag Name:: $Name: $
6 ! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
7 ! License:: See COPYRIGHT[link:../../COPYRIGHT]
8 !
9 !== Overview
10 !
11 ! C の sprintf(3) のように文字列をフォーマットして返します。
12 ! ただし、実装は C の sprintf(3) とは大分違うのでご注意ください。
13 !
14 
15 subroutine dcstringfprintf(unit, fmt, i, r, d, L, n, c1, c2, c3, ca)
16  !
17  ! フォーマット文字列 fmt に従って変換された文字列を
18  ! 装置番号 unit に返します。unit を省略する場合には標準出力に返します。
19  ! 第2引数 fmt には指示子を含む文字列を与えます。
20  ! 指示子には「<tt>%</tt>」を用います。
21  ! <tt>%</tt> を用いたい場合は 「<tt>%%</tt>」と記述します。
22  ! 指示子および用例に関しての詳細は dc_utils/dcstringsprintf.f90 を参照ください。
23  !
24  use dc_types, only: string, dp
25  use dc_string, only: printf
26  implicit none
27  integer, intent(in), optional:: unit
28  character(*), intent(in):: fmt
29  integer, intent(in), optional:: i(:), n(:)
30  real, intent(in), optional:: r(:)
31  real(DP), intent(in), optional:: d(:)
32  logical, intent(in), optional:: L(:)
33  character(*), intent(in), optional:: c1, c2, c3
34  character(*), intent(in), optional:: ca(:)
35  character(STRING):: buf
36 continue
37  call printf(buf, fmt, i=i, r=r, d=d, l=l, n=n, &
38  & c1=c1, c2=c2, c3=c3, ca=ca)
39  if (present(unit)) then
40  write(unit, '(A)') trim(buf)
41  else
42  write(*, '(A)') trim(buf)
43  endif
44 end subroutine
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
文字型変数の操作.
Definition: dc_string.f90:24
subroutine dcstringfprintf(unit, fmt, i, r, d, L, n, c1, c2, c3, ca)
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118