Created
June 22, 2022 03:52
-
-
Save rahulbanerjee26/145230377250948113b60f0bb7381a22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function readFromFile(path, data, ForReading){ | |
//create and write to the previous file | |
var writeSystemObject = new ActiveXObject("Scripting.FileSystemObject"); | |
var writeStream = writeSystemObject.CreateTextFile(path,true); | |
writeStream.Write(data); | |
writeStream.close(); | |
//Read from the file | |
var readSystemObject = new ActiveXObject("Scripting.FileSystemObject"); | |
var readStream = readSystemObject.OpenTextFile(path, ForReading); | |
var text = readStream.ReadLine(); | |
console.log("Text read from file: "+text) | |
readStream.close(); | |
} | |
readFromFile("C:\\theFile.txt", "This text was written using a TextStream",1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment