..


Sponsored Links

Column

The Column property of 'TextStream returns the current character position.

Note: This property is considered as the beginning of the character 1 line.
To get the number of current character in the line is necessary, in practice, perform a subtraction of -1 to the result produced by this natural property.

Let's take an example.
Suppose you have a text file (c: \ test.txt) with the following contents:

 



 Hello what's your name?

 
Now we see the code:





 dim fs, t, x, y









 'I create an instance of the FSO







 Set fs = Server.CreateObject ("Scripting.FileSystemObject")

 







 'I open the file in read mode







 set T = fs.OpenTextFile ("c: \ test.txt", 1, false)









 'I create a loop that is stopped at the end of the file







 do while t.AtEndOfStream <> true



  



 x = t.Read (1)



  



 y-1 = t.Column







 loop









 'I close everything







 t.Close







 Set T = Nothing







 Set fs = Nothing









 'Print to video

 





 Output:

 
 



 The last character in the text file is:?







 character position: 20

 

In the same category ...
E-Learning
ASP (Advanced) ASP (Advanced)
Full course for creating dynamic Web sites. From 39 €.
ASP Zero (Ebook) ASP Zero (Ebook)
Learning Microsoft ASP and VBScript from scratch. At only 29 €.
ASP and Access (Ebook) ASP and Access (Ebook)
Managing a MS Access database with ASP. At only 29 €.
Sponsored Links