Silverfrost Forums

Welcome to our forums

attach@ and Windows XP

17 Oct 2006 7:09 #1152

I tried to get an old (DOS/FTN77) directory search routine to work, and find that it can not attach to the directory I want. The original code has a call to DIRENT@, but I found I had to replace it with FILES@. I finally found that after attaching to the selected directory, I lost the attachment on exiting the program. The following program is just the final attach@ call, but does not work as I expected, as the selected directory is lost when the program terminates. Can the attach@ call update the local directory on exiting the program below ? Does anyone know if this is a change with Windows XP, FTN95 or some other ?

! PROGRAM TO FIND THE SPECIFIED DIRECTORY ! character cmnam256, target_path256, & curdir@256, default_path256 integer2 error_code external cmnam, curdir@, attach@, doserr@ ! !--- get the local path ! default_path = curdir@() write (,) 'the current path is ', trim(default_path) ! !--- read the command line for the directory ! target_path = cmnam() write (,) 'the target directory is ', trim(target_path) ! write (,*) 'Attaching to ',trim(target_path) call attach@ (target_path, error_code) call doserr@ (error_code) ! call exit (0) ! end

18 Oct 2006 5:43 #1153

John

I think the short answer is no.

You can change the current working directory within the current process but it does not change the current working directory in the calling process. In other words, the change is only effective whilst the executable is running.

Please login to reply.