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(์ด์ง„ ๋ชจ๋“œ๋กœ ํŒŒ์ผ ์—ด๊ธฐ)

Error codes:

5 ์ž˜๋ชป๋œ ํ”„๋กœ์‹œ์ € ํ˜ธ์ถœ์ž…๋‹ˆ๋‹ค.

52 ์ž˜๋ชป๋œ ํŒŒ์ผ ์ด๋ฆ„ ๋˜๋Š” ๋ฒˆํ˜ธ์ž…๋‹ˆ๋‹ค.

์˜ˆ:


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

Please support us!