Saved Bookmarks
| 1. |
Write a program to read a text file “exam.txt” and display the no. of spaces in the file.For example , if the content of the file exam.txt isFailure will never overtake me if my determination to succeed is strongThen the output of the program should be 11. |
|
Answer» <% set fs=CreateObject("Scripting.FileSystemObject") set f=fs.OpenTextFile("exam.txt"),1) while not f.AtEndOfStream ch=f.Read(1) if ch=" " then count=count+1 end if wend f.Close response.write(count) set f=nothing set fs=nothing %> |
|