Scripting Runtime Library(TextStream)

ÆÄÀÏ Æ÷ÀÎÅÍ°¡ TextStream ÆÄÀÏÀÇ ÁÙ ³¡¿¡ ¿Ô´Â°¡¸¦ ºÎ¿ï°ªÀ¸·Î ¹ÝȯÇÑ´Ù.

Àμö
TextStream : (°³Ã¼)

object´Â Ç×»ó TextStream °³Ã¼ÀÇ À̸§ÀÌ´Ù.

: (¼Ó¼º ºÎ¿ï°ª)
¼Ó¼º°ªÀº ÆÄÀÏ Æ÷ÀÎÅÍ°¡ TextStream ÆÄÀÏÀÇ ÁÙ ³¡¿¡ ¿Ô´Â°¡¸¦ ³ªÅ¸³»´Â ºÎ¿ï°ªÀÌ´Ù.

false ÆÄÀÏ Æ÷ÀÎÅÍ°¡ TextStream ÆÄÀÏÀÇ ÁÙ ³¡¿¡ ¿ÀÁö ¾Ê¾Ò´Ù.
true ÆÄÀÏ Æ÷ÀÎÅÍ°¡ TextStream ÆÄÀÏÀÇ ÁÙ ³¡¿¡ ¿Ô´Ù.

ÀÌ ¼Ó¼ºÀº ÀбâÀü¿ëÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.

Ư±â

AtEndOfLine ¼Ó¼ºÀº ¿­·ÁÀÖ´Â TextStream ÆÄÀÏ¿¡¸¸ Àû¿ëµÈ´Ù.
±×·¸Áö ¾ÊÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.



AtEndOfLine ¼Ó¼º ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript AtEndOfLine ¿¹Á¦
<SCRIPT language=JScript>
function AtEndOfLineTest(filePath){
  var fso,fileObj,ForReading,str='';
  ForReading=1;
  ForWriting=2;
  fso=new ActiveXObject('Scripting.FileSystemObject');
  fileObj=fso.OpenTextFile(filePath,ForWriting,true);
  fileObj.Write('ù° ¹®´Ü ');
  fileObj.Write('µÑ° ¹®´Ü ');
  fileObj.Write('¼¼Â° ¹®´Ü ');
  fileObj.Write('³×° ¹®´Ü ');
  fileObj.Close();

  fileObj=fso.OpenTextFile(filePath,ForReading,false);
  while (!fileObj.AtEndOfLine) str+=fileObj.Read(1);
  fileObj.Close();
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show
  onClick="showjs.innerHTML=AtEndOfLineTest('C:\\JsTest\\expSample.txt')">
  <SPAN class=ie>JScript</SPAN> <SPAN class=property>AtEndOfLine</SPAN> ¿¹Á¦</DIV>
°á°ú Ç¥½Ãâ
VBScript AtEndOfLine ¿¹Á¦
<SCRIPT language=VBScript>
Function ReadEntireFilevb(filePath)
  Const ForReading=1,ForWriting=2
  Dim fso,fileObj
  str=""
  Set fso=CreateObject("Scripting.FileSystemObject")
  Set fileObj=fso.OpenTextFile(filePath,ForWriting,true)
  fileObj.Write "ù° ¹®´Ü "
  fileObj.Write "µÑ° ¹®´Ü "
  fileObj.Write "¼¼Â° ¹®´Ü "
  fileObj.Write "³×° ¹®´Ü "
  fileObj.Close

  Set fileObj=fso.OpenTextFile(filePath,ForReading,False)
  Do While fileObj.AtEndOfLine<>true
    str=str&fileObj.Read(1)
  Loop
  fileObj.Close
  ReadEntireFilevb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show
  onClick="showvb.innerHTML=ReadEntireFilevb('C:\JsTest\expSample.txt')">
  <SPAN class=ie>VBScript</SPAN> <SPAN class=property>AtEndOfLine</SPAN>