logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • How to read and write a file using javascript?


  • Correct Answer
  • Files can be read and written by using java script functions ? fopen(),fread() and fwrite() The function fopen() takes two parameters ? 1 Path and 2 Mode (0 for reading and 3 for writing) The fopen() function returns -1, if the file is successfully opened Ex: file=fopen(getScriptPath(),0); The function fread() is used for reading the file content Ex: str = fread(file,flength(file)); The function fwrite() is used to write the contents to the file Ex(): file = fopen("c:\MyFiletxt", 3);// opens the file for writing fwrite(file, str);// str is the content that is to be written into the file 


  • Technology problems


    Search Results


    • 1. What does isNaN function do?
    • Discuss
    • 2. What are windows object and navigator object in JavaScript?
    • Discuss
    • 3. What is decodeURI(), encodeURI() in JavaScript?
    • Discuss
    • 4. How to set the cursor to wait in JavaScript?
    • Discuss
    • 5. How to Accessing Elements using javascript?
    • Discuss
    • 6. How to create arrays in JavaScript?
    • Discuss
    • 7. What are Math Constants and Functions using JavaScript?
    • Discuss
    • 8. What is Shift() method in Javascript?
    • Discuss
    • 9. Explain VBScript in detail.
    • Discuss
    • 10. .What are the different types of environments available in the web?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment