Scripting Runtime Library(TextStream)
TextStream ÆÄÀÏÀ» ÀÐÀ» ¶§ ´ÙÀ½ ÁÙÀ» °Ç³Ê¶Ú´Ù.
object´Â Ç×»ó TextStream °³Ã¼ÀÇ À̸§ÀÌ´Ù.
ÆĶó¸ÞÅÍ´Â ¾ø´Ù.
¹Ýȯ°ªÀº ¾ø´Ù.
TextStream ÆÄÀÏÀ» ÀÐÀ» ¶§ ´ÙÀ½ ÁÙÀ» °Ç³Ê¶Ú´Ù.
°Ç³Ê¶Ú ÁÙÀÇ ¹®ÀÚ´Â ¹ö¸°´Ù.
<SCRIPT language=JScript> function SkipLineTest(filePath){ var fso,fileObj,str=''; var ForReading=1,ForWriting=2; fso=new ActiveXObject('Scripting.FileSystemObject'); if (fso.FileExists(filePath)) fso.DeleteFile(filePath); fileObj=fso.OpenTextFile(filePath,ForWriting,true); fileObj.WriteLine('¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏÀÌ´Ù.'); fileObj.WriteLine('1234567890\n987654321'); fileObj.WriteLine('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); fileObj.Close(); str+='¿¹Á¦¸¦ À§ÇÑ '+filePath+' ÆÄÀÏÀ» »ý¼ºÇÏ¿´´Ù.<BR><BR>'; fileObj=fso.OpenTextFile(filePath,ForReading); str+='fileObj.ReadLine()='+fileObj.ReadLine()+'<BR>'; str+='fileObj.ReadLine()='+fileObj.ReadLine()+'<BR>'; str+='fileObj.ReadLine()='+fileObj.ReadLine()+'<BR>'; str+='fileObj.ReadLine()='+fileObj.ReadLine()+'<BR><BR>'; fileObj=fso.OpenTextFile(filePath,ForReading); str+='fileObj.Read(5)='+fileObj.Read(5)+'<BR>'; str+='fileObj.Skip(5)<BR>';fileObj.Skip(5); str+='fileObj.Read(5)='+fileObj.Read(5)+'<BR>'; str+='fileObj.SkipLine()<BR>';fileObj.SkipLIne(); str+='fileObj.Skip(5)<BR>';fileObj.Skip(5); str+='fileObj.ReadLine()='+fileObj.ReadLine()+'<BR>'; str+='fileObj.Read(5)='+fileObj.Read(5)+'<BR>'; str+='fileObj.Skip(5)<BR>';fileObj.Skip(5); str+='fileObj.Read(5)='+fileObj.Read(5)+'<BR>'; str+='fileObj.ReadAll()='+fileObj.ReadAll()+'<BR>'; return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="id=showjs.innerHTML=SkipLineTest('C:\\JsTest\\CreateText.txt')"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>SkipLine</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function SkipLineTestvb(filePath) Const ForReading=1,ForWriting=2,ForAppending=8 Dim fso,fileObj,str Set fso=CreateObject("Scripting.FileSystemObject") If fso.FileExists(filePath) Then fso.DeleteFile(filePath) End If Set fileObj=fso.OpenTextFile(filePath,ForWriting,True) fileObj.WriteLine "¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏÀÌ´Ù." fileObj.WriteLine "1234567890" fileObj.WriteLine "987654321" fileObj.WriteLine "ABCDEFGHIJKLMNOPQRSTUVWXYZ" fileObj.Close str=str&"¿¹Á¦¸¦ À§ÇÑ "&filePath&" ÆÄÀÏÀ» »ý¼ºÇÏ¿´´Ù.<BR><BR>" Set fileObj=fso.OpenTextFile(filePath,ForReading) str=str&"fileObj.ReadLine="&fileObj.ReadLine&"<BR>" str=str&"fileObj.ReadLine="&fileObj.ReadLine&"<BR>" str=str&"fileObj.ReadLine="&fileObj.ReadLine&"<BR>" str=str&"fileObj.ReadLine="&fileObj.ReadLine&"<BR><BR>" Set fileObj=fso.OpenTextFile(filePath,ForReading) str=str&"fileObj.Read(5)="&fileObj.Read(5)&"<BR>" str=str&"fileObj.Skip(5)<BR>" fileObj.Skip(5) str=str&"fileObj.Read(5)="&fileObj.Read(5)&"<BR>" str=str&"fileObj.SkipLine()<BR>" fileObj.SkipLIne str=str&"fileObj.Skip(5)<BR>" fileObj.Skip(5) str=str&"fileObj.ReadLine()="&fileObj.ReadLine()&"<BR>" str=str&"fileObj.Read(5)="&fileObj.Read(5)&"<BR>" str=str&"fileObj.Skip(5)<BR>" fileObj.Skip(5) str=str&"fileObj.Read(5)="&fileObj.Read(5)&"<BR>" str=str&"fileObj.ReadAll="&fileObj.ReadAll&"<BR>" SkipLineTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML=SkipLineTestvb('C:\\JsTest\\CreateText.txt')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>SkipLine</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>