473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Reading / Writing a text file?

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
4 6898
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Kevin T. Ryan | last post by:
Hi All - I'm not sure, but I'm wondering if this is a bug, or maybe (more likely) I'm misunderstanding something...see below: >>> f = open('testfile', 'w') >>> f.write('kevin\n') >>>...
4
by: john smith | last post by:
Hi, I have a file format that is going to contain some parts in ascii, and some parts with raw binary data. Should I open this file with ios::bin or no? For example: filename: a.bin number of...
4
by: Oliver Knoll | last post by:
According to my ANSI book, tmpfile() creates a file with wb+ mode (that is just writing, right?). How would one reopen it for reading? I got the following (which works): FILE *tmpFile =...
2
by: Jeevan | last post by:
Hi, I have an array of data (which I am getting from a socket connection). I am working on a program which acts on this data but the program is written to work on data from a file (not from an...
1
by: Need Helps | last post by:
Hello. I'm writing an application that writes to a file a month, day, year, number of comments, then some strings for the comments. So the format for each record would look like:...
9
by: Alex Buell | last post by:
I have a small text file which consist of the following data: ]] And the code I've written is as follows: ]] The trouble is, I can't work out why it goes into an infinite loop reading the...
6
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
42
by: psbasha | last post by:
Hi, Is it necessary in Python to close the File after reading or writing the data to file?.While refering to Python material ,I saw some where mentioning that no need to close the file.Correct me...
2
by: Clive Green | last post by:
Hello peeps, I am using PHP 5.2.2 together with MP3_Id (a PEAR module for reading and writing MP3 tags). I have been using PHP on the command line (Mac OS X Unix shell, to be precise), and am...
4
by: pbj2009 | last post by:
Hello all: I'm pretty stumped on this one. I'm not looking for Code, I'm just trying to figure out the best way to start this since I am new to reading and writing from files. I can't figure out...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.