CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Posts
    14

    Urgent!! How can I get a string from a specific position in a HTML file e.g line 50, 13-20 character

    Urgent!! How can I get a string from a specific position in a HTML file e.g line 50, 13-20 characters


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Urgent!! How can I get a string from a specific position in a HTML file e.g line 50, 13-20 chara



    dim myFile as string
    dim myLine as integer
    dim myString as string
    dim myStringStart as integer
    dim myStringEnd as integer
    dim myLineCounter as integer
    dim strData as string
    dim ok as boolean

    myFile = "c:\myhtml.html" 'file to examine
    myLine = 50 'line to examine
    myStringStart = 13 'starting position of string to get
    myStringEnd = 20 'ending position of string to get
    myLineCounter = 0 'counting lines
    ok = false

    open myFile for input as #1

    do while (not(eof(1)) and not(ok))
    myLineCounter = myLineCounter + 1
    Line input #1, strData
    if myLineCounter = myLine then 'if the read line is the one we need
    myString = mid(myLine,myStringStart,myStringEnd - myStringStart)
    ok = true
    end if
    loop

    if ok then 'if we reached the line
    msgbox "Retrieved " & myString
    else 'in case the file did not contain myLine lines
    msgbox "Retrieving string failed"
    end if





    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured