Scripting Runtime Library(TextStream)
ÁöÁ¤µÈ ÆÄÀÏ À̸§À» ¸¸µé°í ±× ÆÄÀÏÀ» Àаųª ¾²´Âµ¥ »ç¿ëÇÒ ¼ö ÀÖ´Â TextStream °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹Ýȯ°ª oValÀº TextStream °³Ã¼ÀÌ´Ù.
ÀÌ¹Ì Á¸ÀçÇÏ´Â filename¿¡ overwrite Àμö°¡ falseÀ̰ųª ÁöÁ¤µÇ¾î ÀÖÁö ¾ÊÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.
ÆÄÀÏÀ» »ý¼ºÇÏ°í, ¿©´Â ¸Þ¼µå¿¡´Â ÀÌ CreateTextFile ÀÌ¿Ü¿¡µµ OpenTextFile¿Í OpenAsTextStream ¸Þ¼µå°¡ ÀÖÀ¸¸ç »óÈ£ È£¿ÏÀûÀ¸·Î »ç¿ëµÈ´Ù.
<SCRIPT language=JScript> function CreateTextFileTest(filePath){ var fso=new ActiveXObject('Scripting.FileSystemObject'); var fileObj=fso.CreateTextFile(filePath,true); fileObj.WriteLine('Å×½ºÆ®ÀÌ´Ù.'); fileObj.Close(); str='"'+filePath+'"°¡ »ý¼ºµÇ¾ú´Ù.'; return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showjs.innerHTML=CreateTextFileTest('C:\\JsTest\\CreateText.txt')"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>CreateTextFile</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function CreateTextFileTestvb(filePath) Dim fso,fileObj Set fso=CreateObject("Scripting.FileSystemObject") Set fileObj=fso.CreateTextFile(filePath,True) fileObj.WriteLine("Å×½ºÆ®ÀÌ´Ù.") fileObj.Close str="'"&filePath&"'°¡ »ý¼ºµÇ¾ú´Ù." CreateTextFileTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML= CreateTextFileTestvb('C:\\JsTest\\CreateText.txt')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>CreateTextFile</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>