ASP / PerlScript reading and writing to files...

R

roger_owen333

In ASP using PerlScript how do I read and write to files?

I tried:

my $File = $Server->CreateObject("Scripting.FileSystemObject");

my $a = $File->CreateTextFile("c:\\testfile.txt", true);

but the following two lines cause an error???

$a->WriteLine("This is a test.");

$a->Close();

In ASP using JavaScript the following works:

// JScript

var fso = new ActiveXObject("Scripting.FileSystemObject");

var a = fso.CreateTextFile("c:\\testfile.txt", true);

a.WriteLine("This is a test.");

a.Close();
 
G

Gunnar Hjalmarsson

(e-mail address removed) wrote:

<the same question as yesterday>

Why do you repeat the question instead of following up the responses you
got?
 
R

roger_owen333

It would appear after much researching that ASP using PerlScript can
not write to or read from files so I decided to use JavaScript using
ActiveX Objects that does not require ASP. It is possible to read and
write to files with an HTML page using JavaScript alone. This is what I
tried:

<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--

var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.CreateTextFile("c:\\new.txt", true);
file.Write("This is a test.");
file.Write("This is a test.");
file.Write("This is a test.*\n");
file.Write("This is a test.");
file.Write("This is a test.");
file.Write("This is a test.*\n");
file.Close();

var line;

var ForReading = 1;

file = fso_OpenTextFile("c:\\new.txt", ForReading);

while ( !file.AtEndOfStream ){

line = file.ReadLine();

document.write(line);

}

file.Close();

-->
</SCRIPT>

</HEAD>
<BODY>
Testing 123...

</BODY>
</HTML>
 
J

J. Gleixner

It would appear after much researching that ASP using PerlScript can
not write to or read from files so I decided to use JavaScript using
ActiveX Objects that does not require ASP. It is possible to read and
write to files with an HTML page using JavaScript alone. This is what I
tried:

And your perl question is?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top