I think, there is no better way, if you need specific offset in a file you
can use binary read mode, but for reading lines you need to know how many
'\n' were before your line.
Only if you need to reuse the information  form the file, you can read all
data in array Lines[] and refer to it, instead accessing the file again and
again.

On Sun, Jul 3, 2011 at 9:14 AM, sain singh <[email protected]> wrote:

> Hi All,
>
> I need a code, which returns a particuler whole line from the text file.
>
> Does anybody knows any direct function for that, I know below two ways to
> do so but looking for some better method.
>
>
>
>
>
> set fso=CreateObject("scripting.FileSystemObject")
>
>  set ofile=fso.OpenTextFile("c:\sain.txt,false,true)
>
>  Ncount=0
>
>  while ofile.AtEndofSteam<> true
>
>      Ncount=Ncount+1
>
>     if Ncount=3 then
>
>     msgbox ofile.ReadLine
>
>     exit loop
>
>    end if
>
>    Wend
> ,
>
>
>
>
> 'second method
>
>  set fso=CreateObject("scripting.FileSystemObject")
>
>  set ofile=fso.OpenTextFile("c:\sain.txt,false,true)
>
>  str1=ofile.ReadAll
>
> str2=split(str1,char(10),-1,1)
>
> 'so for third line
>
> msgbox str2(2)
>
> '
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to