Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: accessing text files


Message #1 by "Felix Pirvan" <felix.pirvan@e...> on Thu, 6 Dec 2001 13:03:09
I want to open for reading a text file (.txt) and I receive the following 

message:



    Microsoft VBScript runtime (0x800A0005)

    Invalid procedure call or argument

    /optune_asp/index.asp, line 12



I run IIS on a Win2000 machine. Here is my code:



    <%@ LANGUAGE="VBSCRIPT" %>

    <% response.buffer=true %>

    <html>

    <head>

    <title>Log</title>

    <body color="#FFFFFF">



    <%

    Dim fs

    Set fs = Server.CreateObject("Scripting.FileSystemObject")

    Dim stream

    Set stream = fs.OpenTextFile("c:\log.txt", ForReading)

    stream.Close

    Set stream = Nothing

    Set fs = Nothing

    %>



    </body>

    </html>



The line 12 is that with the OpenTextFile() function call. What is wrong?

Message #2 by =?iso-8859-1?Q?Mikael_=D6stberg?= <Mikael.Ostberg@i...> on Thu, 6 Dec 2001 14:08:09 +0100
Hi... 



The ForReading probably doesn't have a value.. They don't have that.. 



Either set it to 1 or replace it with 1.



::mike



-----Original Message-----

From: Felix Pirvan [mailto:felix.pirvan@e...]

Sent: den 6 december 2001 14:03

To: ASP Web HowTo

Subject: [asp_web_howto] accessing text files





I want to open for reading a text file (.txt) and I receive the following 

message:



    Microsoft VBScript runtime (0x800A0005)

    Invalid procedure call or argument

    /optune_asp/index.asp, line 12



I run IIS on a Win2000 machine. Here is my code:



    <%@ LANGUAGE="VBSCRIPT" %>

    <% response.buffer=true %>

    <html>

    <head>

    <title>Log</title>

    <body color="#FFFFFF">



    <%

    Dim fs

    Set fs = Server.CreateObject("Scripting.FileSystemObject")

    Dim stream

    Set stream = fs.OpenTextFile("c:\log.txt", ForReading)

    stream.Close

    Set stream = Nothing

    Set fs = Nothing

    %>



    </body>

    </html>



The line 12 is that with the OpenTextFile() function call. What is wrong?






$subst('Email.Unsub').

Message #3 by "Felix Pirvan" <felix.pirvan@e...> on Thu, 6 Dec 2001 15:13:14 +0200
:)

thanks, it worked!



felix





> Hi... 

> 

> The ForReading probably doesn't have a value.. They don't have that.. 

> 

> Either set it to 1 or replace it with 1.

> 

> ::mike




  Return to Index