스크립트 open에 대한 질문입니다.

by 녹색주머니 posted Jan 07, 2010
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
안녕하세요~ 전역을 앞에 두고 다시 RPG만들기에 불붙은 녹색주머니입니다+_+

 


---------------------------------------------------------------------------------------------------------------------


open(file[, mode]) {|io| ... }

Opens file and returns a File object. mode specifies one of the following strings. When mode is omitted, the default is "r".



  • "r": Opens file in read mode.

  • "w": Opens file in write mode. If a file already exists when file is opened, the previous file's contents will be deleted.

  • "a": Opens file in write mode. Output will always be appended to the end of the file.

Using "+" opens the file in read-write mode (RDWR):




  • "r+": Sets the read-write position to the beginning of the file.

  • "w+": The same as "r+", but if a file already exists when file is opened, the previous file's contents will be deleted.

  • "a+": The same as "r+", but if a file already exists when file is opened, the read-write position will be set to the end of the file.

The "b" flag can also be added to any of these (in the format "r+b") to open the file in binary mode.


--------------------------------------------------------------------------------------------------------------------


 


대충 r은 읽기모드. w는 쓰기모드라는 건 알겠는데..


 


Q1.  w와 a의 차이점.


 


Q2. +의 기능은?  안 붙이면 파일의 첫단부터 읽는거고 붙이면 마지막단부터읽는게 맞는지...


 


Q3. b는 ? 제한모드라는데 전혀 감을 못잡겠네요.


Articles

1 2 3 4 5 6 7 8 9 10