forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

write_url@

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Chemie



Joined: 07 Mar 2015
Posts: 48

PostPosted: Wed Apr 11, 2018 4:29 pm    Post subject: write_url@ Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5497
Location: Salford, UK

PostPosted: Wed Apr 11, 2018 4:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chemie



Joined: 07 Mar 2015
Posts: 48

PostPosted: Thu Apr 12, 2018 11:34 am    Post subject: Re: Reply with quote

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
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 981

PostPosted: Thu Apr 12, 2018 12:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chemie



Joined: 07 Mar 2015
Posts: 48

PostPosted: Thu Apr 12, 2018 3:02 pm    Post subject: Re: Reply with quote

I have tested both, system32 and syswow64. The error message is the same.
Hartmut
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5497
Location: Salford, UK

PostPosted: Thu Apr 12, 2018 3:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chemie



Joined: 07 Mar 2015
Posts: 48

PostPosted: Thu Apr 12, 2018 3:35 pm    Post subject: Re: Reply with quote

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
View user's profile Send private message
Chemie



Joined: 07 Mar 2015
Posts: 48

PostPosted: Thu Apr 12, 2018 4:49 pm    Post subject: Re: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5497
Location: Salford, UK

PostPosted: Thu Apr 12, 2018 6:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1872
Location: South Pole, Antarctica

PostPosted: Thu Apr 12, 2018 10:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
Chemie



Joined: 07 Mar 2015
Posts: 48

PostPosted: Fri Apr 13, 2018 9:46 am    Post subject: Re: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5497
Location: Salford, UK

PostPosted: Fri Apr 13, 2018 10:54 am    Post subject: Reply with quote

Thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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