
Good Evening

I have a set of fortran code that prints results to the screen when executed from the dos shell under windows.
I want to capture the screen output directly into R when the code is executed via a shell command.   I find that we can do this when the code is compiled with Lahey's 32 bit compiler but can not do this when the code is compiled with gfortran.  Both .exe objects display the results properly when executed from the dos shell. Can anyone  explain why this is happening.  The following demonstrates:

Fortran code
!*************************************************************
      program writetest
!*************************************************************      
      write(*,*) 'Hello World'
      stop
      end
!************************************************************      


Compile commands (LF95 calls Lahey's compiler and creates writetest.exe)


lf95 writetest.for
gfortran writetest.for -o Gwritetest.exe

R script


tmp1=shell('writetest.exe',intern=TRUE)
tmp2=shell('Gwritetest.exe',intern=TRUE)
> tmp1
[1] "Hello World"
> tmp2
character(0)



I would sincerely appreciate if someone could explain why this is happening and send me a note at:

brwin338@aol.com

Joe.




	[[alternative HTML version deleted]]

