Getting this to Work
- Posted by c.k.lester <euphoric at cklester.com> Apr 01, 2007
- 587 views
Can anybody figure out what's wrong with this code?
without warning include uniquefn.e global function getRSSFeed( sequence url ) sequence result, sys, lines object fname, fn, line atom timer result = "" fname = uniquefn("") sys = "wget -q -b -O " & fname & " -o " & "wget.log " & url fn = system_exec(sys,2) fn = open(fname,"r") timer = time() + 1 while fn = -1 and time() < timer do -- give it a second to open the file fn = open(fname,"r") end while if fn > 0 then -- opened the file lines = "" line = gets(fn) while sequence(line) do lines &= line line = gets(fn) end while close(fn) if length(lines) > 0 then result = "Success from " & fname & ":\n" & lines else result = "Failed to get anything from " & fname & " (fn = " & sprintf("%d",{fn}) & ")" end if else result = "Failed to open file " & fname end if return result end function puts(1,getRSSFeed("http://www.listfilter.com/EUforum/messages.xml"))
The uniquefn.e can be gotten from here: http://cklester.com/euphoria/?snippet=uniquefn.snippet