|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Thu Jul 24, 2008 4:29 pm Post subject: Reading files stored on the web |
|
|
Is it possible to simply "open(unit=n,file='http://..." a file stored at a particular web adress and read/write the data as though it was a local file?
Regards
Ian |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Thu Jul 24, 2008 6:26 pm Post subject: |
|
|
Probably not but there is a routine called READ_URL@ that should do the trick. It is in the help file. |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Fri Jul 25, 2008 8:21 am Post subject: |
|
|
Thanks Paul,
I tried adding that but the read_url@ returned ierror=1.
Code below, please specify a url and file of your own that will work.
Thanks
Ian
Code: |
winapp
include <windows.ins>
character*80 url,file,line
integer*4 imode,ierror,ios,i,ii
url = 'http://.............'
file = 'c:\temp_file.txt'
imode=1
call read_url@(url,file,imode,ierror)
print *,'ierror=',ierror
if(ierror .eq. 0)then
open(unit=10,file=file,status='readonly',iostat=ios)
if(ios .eq. 0)then
do i=1,1000
ii=i
read(10,1000,end=999,err=888)line
1000 format(a)
print *,trim(line)
enddo
print *,'Finished ii=',ii
stop
888 continue
print *,'terminated on error ii=',ii
stop
999 continue
print *,'terminated on end ii=',ii
stop
else
print *,'ios=',ios
endif
endif
end
|
|
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Fri Jul 25, 2008 1:10 pm Post subject: |
|
|
The read_url works like charm.
I used it for stock trading code almost a half-decade ago for gathering data in real time from several dozen of websites... then was some text manipulation and html parsing and finally displaying all that data in a click on a multi-monitor screen. All done in FTN95 & Clearwin+ only
And often made jokes, that loading data from internet can be done just in one fortran line. Like this (Copyrighted ):
Code: | use clrwin;k=0;dowhile(k==0);call READ_URL@('http://forums.silverfrost.com/index.php','res.htm',0,i);call sleep@(10.);enddo;end |
Don't use this code on Silverfrost website with small sleep time
One more line will call the browser and display the URL
Where you will find fortran compiler which can do that ???? |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Mon Jul 28, 2008 5:01 pm Post subject: |
|
|
Dan,
You are right, it works like a dream, even my program did, but it needs to be on a decent machine, unlike the one I tried it on.
The moral of the story is "Don't by a HP/Compaq"
Ian |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Tue Jul 29, 2008 12:26 pm Post subject: |
|
|
and I think writing several such examples for everyone use would be killing applications. Specifically if all will be done in true Windows fashion using Visual Clearwin like latest SDK for iPhone is working. That is just a dream. And if the next Clearwin will look and make applications like that...
http://au.youtube.com/watch?v=kYgV2GlsufI&feature=related |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|