作者Gwaewluin (神無月 孝臣)
看板Fortran
標題[問題] 有什麼方法可以知道檔案內資料個數?
時間Sun Jan 10 00:41:31 2010
我有兩個檔案
一個長的像這樣一行內有三個資料
1 0.0 0.0
2 0.1 0.1
3 0.2 0.2
一個長得像這樣一行內有四個資料
1 0.0 0.0 0.0
2 0.1 0.1 0.1
3 0.2 0.2 0.2
請問有什麼辦法可以讓我判斷出在讀的檔案一行內有幾個資料呢?
--
Deserves death! I daresay he does. Many that live deserve death. And some die
that deserve life. Can you give that to them? Then be not too eager to deal out
death in the name of justice, fearing for your own safty. Even the wise cannot
see all ends.
Gandalf to Frodo
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.131.229.148
1F:推 laa7352:如果你的資料是有格式的話,可以用字串整行讀下來 01/10 11:35
2F:→ laa7352:再寫判斷式去抓字串上面的資料 01/10 11:37
3F:→ gjohnlua:讀進一行後,檢查總共有幾個空格可行嗎?資料要夠整齊.. 01/11 11:34