- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Will A. below do the same as B. but better (because not restricted to 1-5 characters) ?
A. READ(cv,*) iv
B. where fw (passed variable) equals field width:
if (fw.eq.1) then
read(cv,'(i1)') iv
elseif (fw.eq.2) then
read(cv,'(i2)') iv
elseif (fw.eq.3) then
read(cv,'(i3)') iv
elseif (fw.eq.4) then
read(cv,'(i4)') iv
elseif (fw.eq.5) then
read(cv,'(i5)') iv
endif
Thanks,
Keith
A. READ(cv,*) iv
B. where fw (passed variable) equals field width:
if (fw.eq.1) then
read(cv,'(i1)') iv
elseif (fw.eq.2) then
read(cv,'(i2)') iv
elseif (fw.eq.3) then
read(cv,'(i3)') iv
elseif (fw.eq.4) then
read(cv,'(i4)') iv
elseif (fw.eq.5) then
read(cv,'(i5)') iv
endif
Thanks,
Keith
コピーされたリンク
2 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Not quite - using * will allow input such as 2.45 or T and convert it to integer.
You don't need the complicated IF tests. Just use a format of '(BN,I5)')
Steve
You don't need the complicated IF tests. Just use a format of '(BN,I5)')
Steve
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Thanks, Steve. BN works great.
Keith Richardson
Keith Richardson
