본문 바로가기

Program & etc/Visual Basic

[visual basic] 입력용 파일열기

Dim f As integer

Dim msg(60) As String

 

f = FreeFile                                                        '파일번호얻기
                                                                        '파일을 입력용으로 열기

Open App.Path & "\파일이름.ini" For Input As f     'App.Path -> 현재 제작한 프로그램

                                                                         위치반환
    i = 0

    Do Until EOF(1)                                              'EOF -> 파일의 끝날때까지 실행하라
          Line Input #1, msg(i)                                 '열여있는 파일에서 1라인씩 읽어서

                                                                         msg변수에 저장

          i = i + 1

     Loop   
Close f