Jump to content

Can't read file that comes from InetGet


Tellblom
 Share

Recommended Posts

I Use this code when getting a html page to the local disk

Local $hDownload = InetGet("http://www.mywebpage.com/search.asp?q=" & $PartNumber, @ScriptDir & "\temp.dat", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)    ; Check if the download is complete.
InetClose($hDownload)

When I later on tries to read from the temp.dat file It does not work.

$file1 = FileOpen(@ScriptDir+"\temp.dat", 0)

$line2 = FileReadLine($file1,1)

MemoWrite( "WebLine=" & $line2)

get no error, $file1 returns a filehandenumber but $line2 is blank

If I manually copy the file to a different file the problem persists.

If I open the file in Notepad and copy the text and the paste it in another file then I can get a value to $line2

What have I done wrong?

Link to comment
Share on other sites

Did you really use that "+" in this line?

$file1 = FileOpen(@ScriptDir+"\temp.dat", 0)

Also did you try to do any error checking when reading the line? Something like..

$line2 = FileReadLine($file1,1)

If @error then memowrite(@error)

Link to comment
Share on other sites

The context of the file is HTML codes

And thanx Beege it was a typo It all works with '&' instead og the '+'

Thanx alot

Glad I could help. Also, if your not already using Scite, you should. SyntaxCheck(ctrl+F5) under tools will catch almost all syntax errors like that one. :mellow:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...