我試圖從用戶追加一些輸入到文件中。但是我收到一個奇怪的錯誤...它說,追加只能取2個參數,而不是4如何將用戶輸入附加到文件中Haskell
這是代碼:
ame :: IO()
ame = do
putStr "Enter the file name: "
name <- getLine
putStrLn "Do you want to add new records? "
question <- getLine
if question == "yes" then do
putStrLn "Enter your records:"
newRec <- getLine
appendFile name ('\n':newRec)
putStrLn "enter something new: "
something <- getLine
appendFile name ('\n':something)
putStrLn "enter something new again: "
something2 <- getLine
appendFile name ('\n':something2)
putStrLn "a"
else
putStr "b"
有人可以幫助我?
這次請不要刪除你的問題 - 等待我回答! (我寫了一個完整的答案,但你在寫作時刪除了這個問題) – AndrewC
是的。抱歉。我刪除了第一個,因爲在某個時候它工作。但後來..發生了另一個問題.. – Selyst
這是同樣的問題...堅持.... – AndrewC