replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Using DOS command in CGI
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 

Using DOS command in CGI

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
dc7669



Joined: 08 Oct 2008
Posts: 6

PostPosted: Mon Dec 22, 2008 10:22 pm    Post subject: Using DOS command in CGI Reply with quote

I had a CGI that used Cissue to move/copy/del some files. It is now not working after IIS upgrade, server upgrade, etc. (It is somewhat related to my othe post a few months back.)

My code:
Command='copy e:\rxemail\temp.htm e:\rxemail\temp2.htm'
call cissue(Command, i)
write(*,*) '<p>', Command, i

i=start_process@('copy e:\rxemail\temp.htm e:\rxemail\temp3.htm','')
write(*,*) '<p> Start_Process@', i

Result will show up in Internet Explorer. The first i is 0, indicating the command good, but the sceond i is -1, indicating the command is bad.
There is no copy.exe in the directory. Is that why the start_process@ command did not work?

Anyway, how can I use DOS command in CGI?

Thank you.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Dec 23, 2008 11:09 am    Post subject: Reply with quote

There is a Windows API functin CopyFile that copies files directly, also the FTN95 routine ERASE@ can be used to delete a file.

To move a file you can copy then delete, then rename (RENAME@).
A direct alternative is to use the Windows API MoveFileEx.

start_process@ and start_pprocess@ ought to work also.
Back to top
View user's profile Send private message AIM Address
dc7669



Joined: 08 Oct 2008
Posts: 6

PostPosted: Tue Dec 23, 2008 10:41 pm    Post subject: Window API Reply with quote

What is Window API? Can you give an example how CopyFile will work?

It seems to me that CGI and DOS Internal Commands (dir, del, copy, etc) don't work together any more. I tried using Cissue and Start_process@ using DOS Internal Commands and they all failed.

So, to copy a file, I resort to use open and write commands. For sure, if I don't know the length of each line, I am doomed. In my particular case, I know the length of each line in my file.

For delete a file, Erase@ works.

Thank you.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Dec 24, 2008 10:28 am    Post subject: Reply with quote

Code:
      STDCALL MoveFile 'MoveFileA' (STRING,STRING):logical
      STDCALL CopyFile 'CopyFileA' (STRING,STRING,VAL):logical
      character*256 existingFile, newFile
      integer failIfExists
      logical done
      existingFile = "c:\techsupport\share1.f90"
      newFile = "c:\techsupport\copy.f90"
      failIfExists = 1
      done = CopyFile(existingFile, newFile, failIfExists)
      done = MoveFile(existingFile, newFile)
      end


You can use include <windows.ins> instead of the first two lines if you prefer.

The functions are described on the Microsoft MSDN website (use Google to locate).
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Wed Dec 24, 2008 4:45 pm    Post subject: Reply with quote

Code:
 integer r,start_process@
 r = start_process@('cmd /c copy "c:\techsupport\share1.f90" "c:\techsupport\ccpy.f90"', " ")
 end


Code:
integer(2) ierr
call cissue@('copy "c:\techsupport\share1.f90" "c:\techsupport\ccpy.f90"', ierr)
end


For a DOS command, start_process@ requires the "cmd /c" prefix. This is provided for you when you use cissue@. I have put the file name in double quotes but these are not required if the name does not contain spaces
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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