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
Welcome to our forums
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
Probably not but there is a routine called READ_URL@ that should do the trick. It is in the help file.
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
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
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 😄 ):
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 ???? 😄
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
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