Scripting Runtime Library(TextStream)

TextStream ÆÄÀÏ¿¡ ÁöÁ¤ÇÑ ¹®ÀÚ¿­À» ¾´´Ù

Àμö/ÆĶó¸ÞÅÍ
object
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç×»ó TextStream °³Ã¼ÀÇ À̸§ÀÌ´Ù.
stringVal
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ÆÄÀÏ¿¡ ¾µ ÅؽºÆ®ÀÌ´Ù.
¹Ýȯ°ª

¹Ýȯ°ªÀº ¾ø´Ù.

¼³¸í

TextStream ÆÄÀÏ¿¡ ÁöÁ¤ÇÑ ¹®ÀÚ¿­°ú ÁÙ ¹Ù²Þ ¹®ÀÚ¸¦ ¾´´Ù.

ÆÄÀÏ¿¡ ÁöÁ¤ÇÑ ¹®ÀÚ¿­À» °¢ ¹®ÀÚ¿­ »çÀÌ¿¡ °ø¹éÀ̳ª ¹®ÀÚ¾øÀÌ ¾´´Ù.
WriteLine ¸Þ¼­µå¸¦ »ç¿ëÇÏ¿© ÁÙ ¹Ù²Þ ¹®ÀÚ³ª ÁÙ ¹Ù²Þ ¹®ÀÚ·Î ³¡³ª´Â ¹®ÀÚ¿­À» ¾´´Ù


Write ¸Þ¼­µå ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript Write ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=JScript>
function WriteTest(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.WriteBlankLines(1);
  fileObj.WriteLine('1234567890\n987654321');
  fileObj.WriteBlankLines(2);
  fileObj.WriteLine('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
  fileObj.WriteBlankLines(1);
  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>';
  str+='fileObj.ReadLine()='+fileObj.ReadLine()+'<BR>';
  str+='fileObj.ReadLine()='+fileObj.ReadLine()+'<BR>';
  str+='fileObj.ReadLine()='+fileObj.ReadLine()+'<BR>';
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="id=showjs.innerHTML=WriteTest('C:\\JsTest\\CreateText.txt')">
  <SPAN class=ie>JScript</SPAN> <SPAN class=method>Write</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
°á°ú Ç¥½Ãâ
VBScript Write ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=VBScript>
Function WriteTestvb(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.Write "¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏÀÌ´Ù."
  fileObj.WriteBlankLines 1
  fileObj.Write "1234567890"
  fileObj.WriteBlankLines 1
  fileObj.Write "987654321"
  fileObj.WriteBlankLines 2
  fileObj.Write "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  fileObj.WriteBlankLines 1
  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>"
  str=str&"fileObj.ReadLine="&fileObj.ReadLine&"<BR>"
  WriteTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=WriteTestvb('C:\\JsTest\\CreateText.txt')">
  <SPAN class=ie>VBScript</SPAN> <SPAN class=method>Write</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>