Re: [問題] 請問fopen的參數
※ 引述《UBC.bbs@ptt.cc (UBC)》之銘言:
> 在fopen mode那邊
來來,都會打字了,原文書也要會看
以下把你引的內容分段,比較容易說明
1> "w" Create an empty file for writing.
2> If a file with the same name already exists its content is erased
> and the file is treated as a new empty file.
3> "w+" Create an empty file for both reading and writing.
4> If a file with the same name already exists its content is erased
> and the file is treated as a new empty file.
有沒有注意到2和4的部份完全一樣?
既然你預期 w 和 w+ 會有差別,
那麼完全一樣的部份,就叫「廢話」,不用看。
> +代表可讀 不是很了解"讀"的意思
你會用fscanf(), fgets(), fread()這些函數吧?
不然至少會fscanf()吧?
> 那麼w+是指在這次處理中 可讀寫嗎
到fclose()以前都是。
--
Opinions : 彼得謝勒的生與死 (2004) : http://blog.bs2.to/post/GOLDMEMBER/9086
美國戰後戰鬥機發展時程,F-80 - XF-108 : http://blog.bs2.to/post/GOLDMEMBER/8981
The UNIVAC Biblestory : http://blog.bs2.to/post/GOLDMEMBER/9041
The James Bond Superweaponry : http://blog.bs2.to/post/GOLDMEMBER/9002
今日的一言(2/10): 登月演說, 1962 : http://blog.bs2.to/post/GOLDMEMBER/7840
http://blog.bs2.to/GOLDMEMBER 法外科學暨工程顧問公司
--
▄▄▄▄▄▄▄ ▄▄▄▄ ▄▄▄▄▄▄ <telnet://bbs.cs.nctu.edu.tw>
█▄▄▄▄█ █ ▄▄▄▄▄█ Player: GOLDMEMBER
▄█▄▄▄▄█ ▄▄▄█ █▄▄▄▄▄ From: 218-160-85-245.dynamic.hine
☆ 次世代BS2 ☆ 可申請個人板 150MB 相簿 http://pic.bs2.to 交大資訊人 250MB
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
Programming 近期熱門文章
PTT數位生活區 即時熱門文章