By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,974 Members | 1,834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,974 IT Pros & Developers. It's quick & easy.

Reading / Writing a text file?

P: n/a
Ok, it must be one of the most fundamentally useful things in a programming
language, to be able to read and write files.

I want to know how i can do this in Javascript. I want to open a text
file, use it to fill some variables on a webpage. And have that webpage
save any changes.

Is there a single command like the C fopen("filename", "ra");?

Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
GlesgaMick wrote:
I want to know how i can do this in Javascript. I want to open a text
file, use it to fill some variables on a webpage. And have that webpage
save any changes.


http://jibbering.com/faq/#FAQ4_3

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2

P: n/a
GlesgaMick wrote:
Ok, it must be one of the most fundamentally useful things in a programming
language, to be able to read and write files.
Depends on the programming language and its environment.
I want to know how i can do this in Javascript. I want to open a text
file, use it to fill some variables on a webpage. And have that webpage
save any changes.
If its running on your local computer, yes, under certain limitations.
If its a Windows based IE, you can use the FileSystemObject to read
files from the local drive and then save them, with security permission
given.

If you want to read/write files on a server, you can read them with an
HTTPRequestObject but JS has no ability to write files on a server, you
have to do that on the server.
Is there a single command like the C fopen("filename", "ra");?


Depends on where the files are. Whether they are on the users computer
or on the server. The FileSystemObject ActiveX in MSIE on a PC can do
that. Search MSDN.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #3

P: n/a
On Sun, 24 Oct 2004 09:41:21 -0400, GlesgaMick wrote:

Given David and Randy have already contributed sensible answers..
Is there a single command like the C fopen("filename", "ra");?


You mean like..

<wild-ass psuedo-code>
IE.fopen("virus.exe", "e")?
</wild-ass psuedo-code>
Jul 23 '05 #4

P: n/a
ok, thanks for the help guys, and no, i don't intend to create a virus,
its a uni project i'm working on, a rather annoying project, i won't bore
you with the specific details...

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.