'텍스트 파일'에 해당되는 글 1건

  1. 2008.04.17 VB2008강좌-텍스트파일 읽어보기 2

NET Framework Library에 있는 StreamReader Class를 이용했음.

 

StreamReader Class

 

StreamReader 클래스를 이용하기 위해서는 코드 맨 상단에 Imports System.IO
추가해 준다
.

폼디자인

사용자 삽입 이미지

 

코딩하기


Imports
System.IO

Public Class Form1

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click

 

        Dim StreamToDisplay As StreamReader

 

        '읽을 txt 파일을 할당

        StreamToDisplay = New StreamReader("E:\test.txt")

 

        '파일 끝까지 읽어서 그 데이터를 txtRead.Text에 입력하라

        txtRead.Text = StreamToDisplay.ReadToEnd

 

        'StreamReader 객체를 닫고 관련 리소스를 release하라.

        StreamToDisplay.Close()

 

 

    End Sub

End Class

test.txt
파일의 내용은 RFC5090의 첫머리를 저장한 것이다.

Network Working Group                                   B. Sterman

Request for Comments: 5090                               Kayote Networks

Obsoletes: 4590                                            D. Sadolevsky

Category: Standards Track                                 SecureOL, Inc.

                                                             D. Schwartz

                                                         Kayote Networks

                                                             D. Williams

                                                           Cisco Systems

                                                                 W. Beck

                                                     Deutsche Telekom AG

                                                           February 2008

 

 

               RADIUS Extension for Digest Authentication

 

Status of This Memo

 

   This document specifies an Internet standards track protocol for the

   Internet community, and requests discussion and suggestions for

   improvements.  Please refer to the current edition of the "Internet

   Official Protocol Standards" (STD 1) for the standardization state

   and status of this protocol.  Distribution of this memo is unlimited.

 

 Abstract

 

   This document defines an extension to the Remote Authentication

   Dial-In User Service (RADIUS) protocol to enable support of Digest

   Authentication, for use with HTTP-style protocols like the Session

   Initiation Protocol (SIP) and HTTP.

실행하기

사용자 삽입 이미지

이상으로 StreamReader 클래스를 이용해서 간단하게 txt파일을 읽어오는 법을 알아보았다.

Posted by 원철연(체르니)
,