Aryan PrajapatKnowledge Contributor
Explain about Read and Write of a file using JavaScript?
Explain about Read and Write of a file using JavaScript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
Basically, there are two ways to read and write a file:
Using JavaScript extensions.
Using a web page and Active X objects.
Given are the steps to read and write a file:
Step 1:
file=fopen(getScriptPath(),0);
fread() is used for reading the file content
Step 2:
str = fread(file,flength(file);
The function fwrite() is used to write the contents of the file.
Step 3:
file = fopen(“c:MyFile.txt”, 3);// it is used for opening the file for writing.
fwrite(file, str);
// str which is specified within the method is the content that is to be written into the file.