FileAttr Function
Open ๋ฌธ์ผ๋ก ์ฐ ํ์ผ์ ์ก์ธ์ค ๋ชจ๋ ๋๋ ํ์ผ ์ก์ธ์ค ๋ฒํธ๋ฅผ ํ์ํฉ๋๋ค. ํ์ผ ์ก์ธ์ค ๋ฒํธ๋ ์ด์ ์ฒด์ ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง๋๋ค(OSH = Operating System Handle).
32๋นํธ ์ด์ ์ฒด์ ๋ฅผ ์ฌ์ฉํ ๊ฒฝ์ฐ FileAttr ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ํ์ผ ์ก์ธ์ค ๋ฒํธ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
์ฐธ๊ณ ํญ๋ชฉ: Open
๊ตฌ๋ฌธ:
FileAttr (FileNumber As Integer, Attribute As Integer)
๋ฐํ ๊ฐ:
Integer
๋งค๊ฐ ๋ณ์:
FileNumber: Open ๋ฌธ์ผ๋ก ์ฐ ํ์ผ์ ๋ฒํธ์ ๋๋ค.
Attribute: ํ์ํ ํ์ผ ์ ๋ณด์ ์ ํ์ ๋ํ๋ด๋ ์ ์ ์์ ๋๋ค. ๋ค์๊ณผ ๊ฐ์ ๊ฐ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
1: FileAttr ํจ์๊ฐ ํ์ผ์ ์ก์ธ์ค ๋ชจ๋๋ฅผ ๋ํ๋ ๋๋ค.
2: FileAttr ํจ์๊ฐ ์ด์ ์ฒด์ ์ ํ์ผ ์ก์ธ์ค ๋ฒํธ๋ฅผ ํ์ํฉ๋๋ค.
๋งค๊ฐ ๋ณ์ ์์ฑ์ 1๋ก ์ง์ ํ ๊ฒฝ์ฐ ๋ค์์ ๋ฐํ ๊ฐ์ด ์ ์ฉ๋ฉ๋๋ค.
1 - INPUT(์ ๋ ฅ์ ์ํ ํ์ผ ์ด๊ธฐ)
2 - OUTPUT(์ถ๋ ฅ์ ์ํ ํ์ผ ์ด๊ธฐ)
4 - RANDOM(์์ ์ก์ธ์ค๋ฅผ ์ํ ํ์ผ ์ด๊ธฐ)
8 - APPEND(์ถ๊ฐ๋ฅผ ์ํ ํ์ผ ์ด๊ธฐ)
32 - BINARY(์ด์ง ๋ชจ๋๋ก ํ์ผ ์ด๊ธฐ)
์:
Sub ExampleFileAttr
Dim iNumber As Integer
Dim sLine As String
Dim aFile As String
aFile = "c:\data.txt"
iNumber = Freefile
Open aFile For Output As #iNumber
Print #iNumber, "This is a line of text"
MsgBox FileAttr(#iNumber, 1 ),0,"Access mode"
MsgBox FileAttr(#iNumber, 2 ),0,"File attribute"
Close #iNumber
End Sub