|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Chemie
Joined: 07 Mar 2015 Posts: 49
|
Posted: Wed Apr 11, 2018 4:29 pm Post subject: write_url@ |
|
|
Hello,
sorry, but I have not found the contrary of read_url@. I want to write to a ftp-server or put a file to a ftp-server. Are there any functions?
Thank you for your help
Hartmut |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Wed Apr 11, 2018 4:57 pm Post subject: |
|
|
No. There is no routine to write a file nor to upload a file at the moment.
read_url@ and download@ call upon InternetReadFile. We don't have any routines that call upon InternetWriteFile at the moment. |
|
Back to top |
|
|
Chemie
Joined: 07 Mar 2015 Posts: 49
|
Posted: Thu Apr 12, 2018 11:34 am Post subject: Re: |
|
|
I have tried to use the functions of wininet.dll (c:\windows\SysWOW64\wininet.dll)under 64bit, but Plato says:
***c:\windows\SysWOW64\wininet.dll is not an x64 DLL file
Where can I find a correct wininet.dll ?
Thanks
Hartmut |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Thu Apr 12, 2018 12:28 pm Post subject: |
|
|
An oddity of the Windows conventions is that SysWow64 is for 32-bit DLLS, whereas System32 is for 64-bit DLLs. You may want to check %PATH%. |
|
Back to top |
|
|
Chemie
Joined: 07 Mar 2015 Posts: 49
|
Posted: Thu Apr 12, 2018 3:02 pm Post subject: Re: |
|
|
I have tested both, system32 and syswow64. The error message is the same.
Hartmut |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Apr 12, 2018 3:05 pm Post subject: |
|
|
Here is an extract from the notes on 64 bit programming...
SLINK64 automatically scans commonly used Windows DLLs. If a Windows function located in (say) xxx.dll is
reported as missing then the DLL should be loaded by using a script command of the form
lo C:\Windows\Sysnative\xxx.dll
where C:\Windows illustrates the value of the %windir% environment variable. |
|
Back to top |
|
|
Chemie
Joined: 07 Mar 2015 Posts: 49
|
Posted: Thu Apr 12, 2018 3:35 pm Post subject: Re: |
|
|
In the meanwhile, I have found a working wininet.dll in the web (dll-files.com). Normaly I use the dll's added by Reference to the Plato Project Explorer. This is easy to handle.
Thanks
Hartmut |
|
Back to top |
|
|
Chemie
Joined: 07 Mar 2015 Posts: 49
|
Posted: Thu Apr 12, 2018 4:49 pm Post subject: Re: |
|
|
The Problem of writing to a ftp-server is solved:
Usind the following Wininet-function as C_EXTERNAL, I can read and write a file to ftp:
C_EXTERNAL InetOpen 'InternetOpenA' (REF,VAL,REF,REF,VAL) : INTEGER*4
C_EXTERNAL InetConnect 'InternetConnectA' (VAL,STRING,VAL,String,String,VAL,VAL,VAL) : INTEGER*4
C_EXTERNAL SetDir 'FtpSetCurrentDirectoryA' (VAL,STRING) : LOGICAL
C_EXTERNAL GetFile 'FtpGetFileA' (VAL,STRING,STRING,VAL,VAL,VAL,VAL) : LOGICAL
C_EXTERNAL PutFile 'FtpPutFileA' (Val,STRING,STRING,VAL, VAL) : LOGICAL
C_EXTERNAL InetClose 'InternetCloseHandle' (VAL) : LOGICAL
For more Information about the Wininet-Functions see:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa385483(v=vs.85).aspx
Hartmut |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Apr 12, 2018 6:31 pm Post subject: |
|
|
Hartmut
If you are able to send me your code, I might be able to include this in the library alongside the existing routines. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2816 Location: South Pole, Antarctica
|
Posted: Thu Apr 12, 2018 10:57 pm Post subject: |
|
|
The Wininet adopted for this compiler in friendly for Fortran definitions (with given self-explanatory names and parameters instead of REF, REF, STRING, VAL, VAL, VAL) is what FTN95 is missing for a long time. I think Intel Fortran has done this right way. |
|
Back to top |
|
|
Chemie
Joined: 07 Mar 2015 Posts: 49
|
Posted: Fri Apr 13, 2018 9:46 am Post subject: Re: |
|
|
Paul,
here is my code:
winapp
program writeftp
use mswin
implicit none
integer*2 errorcode
integer*4 inetopenhandle,inetconnecthandle,sglocal,ierror
integer*4 INTERNET_DEFAULT_FTP_PORT,INTERNET_SERVICE_FTP
integer*4 INTERNET_OPEN_TYPE_DIRECT,INTERNET_FLAG_RELOAD
integer*4 FTP_TRANSFER_TYPE_ASCII
logical bool,bfail
character*80 lpszagent,server,user,password,subdir,remotefile,localfile
C_EXTERNAL InetOpen 'InternetOpenA' (REF,VAL,REF,REF,VAL) : INTEGER*4
C_EXTERNAL InetConnect 'InternetConnectA' (VAL,STRING,VAL,String,String,VAL,VAL,VAL) : INTEGER*4
C_EXTERNAL SetDir 'FtpSetCurrentDirectoryA' (VAL,STRING) : LOGICAL
C_EXTERNAL GetFile 'FtpGetFileA' (VAL,STRING,STRING,VAL,VAL,VAL,VAL) : LOGICAL
C_EXTERNAL PutFile 'FtpPutFileA' (Val,STRING,STRING,VAL, VAL) : LOGICAL
C_EXTERNAL InetClose 'InternetCloseHandle' (VAL) : LOGICAL
C_EXTERNAL Lasterror 'GetLastError' () : Integer*4
lpszagent='agent name'
inetconnecthandle=0
inetopenhandle=0
sglocal=12
ierror=0
server=''
user=''
password=''
subdir=''
remotefile=''
localfile='Test.txt'
bool=.false.
bfail=.false.
INTERNET_DEFAULT_FTP_PORT=21
INTERNET_DEFAULT_FTP_PORT=0
INTERNET_OPEN_TYPE_DIRECT=1
INTERNET_SERVICE_FTP=1
INTERNET_FLAG_RELOAD=Z'80000000'
FTP_TRANSFER_TYPE_ASCII=Z'1'
inetopenhandle=InetOpen(lpszagent,INTERNET_OPEN_TYPE_DIRECT,0,0,0)
if (inetopenhandle.eq.0) then
ierror=Lasterror()
goto 99
endif
inetconnecthandle=InetConnect(inetopenhandle,server,INTERNET_DEFAULT_FTP_PORT,user,password, &
& INTERNET_SERVICE_FTP,0,0)
if (inetconnecthandle.eq.0) then
ierror=Lasterror()
goto 99
endif
bool=SetDir(inetconnecthandle,subdir)
if (.not.bool) then
ierror=Lasterror()
goto 99
endif
bool=GetFile(inetconnecthandle,remotefile,localfile,bfail,INTERNET_FLAG_RELOAD, &
& FTP_TRANSFER_TYPE_ASCII,0)
if (.not.bool) then
ierror=Lasterror()
goto 99
endif
open(sglocal,file=localfile,access='append')
write(sglocal,*) 'this is a new line'
close(sglocal)
bool=PutFile(inetconnecthandle,localfile,remotefile,FTP_TRANSFER_TYPE_ASCII,0)
if (.not.bool) then
ierror=Lasterror()
goto 99
endif
call erase@(localfile,errorcode)
bool=InetClose(inetconnecthandle)
bool=InetClose(inetopenhandle)
99 continue
if (ierror.eq.0) then
write(*,*) 'ok'
else
write(*,*) 'Error = ',ierror
endif
end
The program reads a (ascii)file from a subdirectory of the ftpserver, modifies the file by adding a new line and saves it back to the ftpserver.
Hartmut |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Fri Apr 13, 2018 10:54 am Post subject: |
|
|
Thank you. |
|
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
|