Forum Discussion
tristaanogre
7 years agoEsteemed Contributor
The problem is in your declaration of sPath. Because you're using JavaScript, the backslash (\) character is a control character. In order to have that character in a string, you need to double it. Change your code as noted below paying special attention to the bolded line.
function RetrieveExistingPaitent() { var sPath = "C:\\Files\\MyFile.txt"; // Opens the specified file for reading var myFile = aqFile.OpenTextFile(sPath, aqFile.faRead, aqFile.ctUnicode); Log.Message("File by lines:"); // Reads text lines from the file and posts them to the test log while(! myFile.IsEndOfFile()) { s = myFile.ReadLine(); Log.Message(s); } // Closes the file myFile.Close(); }
Related Content
- 2 months agoStoplight