作者AdonisLam (Adonis)
看板Fortran
標題[問題] 怎麼讀取檔案中的字串
時間Tue Nov 18 23:42:44 2014
請問各位大大
小弟想從檔案中讀取字串
再寫入另一檔案中
小弟是這樣寫的:
character(len=100) :: string
open(10, file='test.txt, status='old', action='read')
open(20, file='output.txt, status='unknow',action='write')
read(10,*) string
write(20,*) wtring
其中test.txt內容為:hello world
但怎麼改輸出在output.txt中的都只有:hello
要怎麼樣才能連空白憶起讀取呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.122.57.38
※ 文章網址: http://webptt.com/m.aspx?n=bbs/Fortran/M.1416325367.A.3B9.html
※ 編輯: AdonisLam (140.122.57.38), 11/18/2014 23:44:16
1F:→ rex0707: read(10,"(A100)") string 11/19 19:42