Click here to Skip to main content
15,914,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Passing filename from C++ to Fortran Pin
RedSonja9-Dec-08 1:26
RedSonja9-Dec-08 1:26 
GeneralRe: Passing filename from C++ to Fortran [modified] Pin
RedSonja9-Dec-08 2:03
RedSonja9-Dec-08 2:03 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 2:29
sitebuilderLuc Pattyn9-Dec-08 2:29 
GeneralRe: Passing filename from C++ to Fortran [modified] Pin
RedSonja9-Dec-08 2:33
RedSonja9-Dec-08 2:33 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 2:40
sitebuilderLuc Pattyn9-Dec-08 2:40 
GeneralRe: Passing filename from C++ to Fortran Pin
RedSonja9-Dec-08 2:43
RedSonja9-Dec-08 2:43 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 3:12
sitebuilderLuc Pattyn9-Dec-08 3:12 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 5:29
sitebuilderLuc Pattyn9-Dec-08 5:29 
Hi,

I installed Silverfrost F95 and was able to run this:

PROGRAM FTEST
IMPLICIT INTEGER(I-N)

INTEGER IOS
CHARACTER*80 FILEN, FLBASE
CHARACTER C

PRINT *,'enter filename1'
READ(5,'(A)',IOSTAT=IOS) FILEN
IF ( IOS .NE. 0 ) STOP 'MUST PROVIDE A FILE NAME'
PRINT *, 'FILEN = *', FILEN, '*'
DO 10 I = 1,80
C=FILEN(I:I)
IF (ICHAR(C).NE.32) PRINT *, 'FILEN[',I,']=',C,'=',ICHAR(C)
10 CONTINUE

PRINT *,'enter filename2'
READ(5,'(A)',IOSTAT=IOS) FLBASE
IF ( IOS .NE. 0 ) STOP 'MUST PROVIDE A ROOT FILE NAME'
PRINT *, 'FLBASE = *', FLBASE, '*'
DO 20 I = 1,80
C=FLBASE(I:I)
IF (ICHAR(C).NE.32) PRINT *, 'FLBASE[',I,']=',C,'=',ICHAR(C)
20 CONTINUE

OPEN(17,FILE=FILEN,FORM='FORMATTED',STATUS='OLD',IOSTAT=IOS)
IF ( IOS .NE. 0 ) THEN
PRINT *, 'ERROR NO INPUT FILE 1 ', IOS
ELSE
PRINT *, 'OPENED INPUT FILE 1 OK'
ENDIF
OPEN(18,FILE=FLBASE,FORM='FORMATTED',STATUS='OLD',IOSTAT=IOS)
IF ( IOS .NE. 0 ) THEN
PRINT *, 'ERROR NO INPUT FILE 2 ', IOS
ELSE
PRINT *, 'OPENED INPUT FILE 2 OK'
ENDIF

END  


it gives OK for existing files, and error 128 for non-existing files.
The documentation says error codes could be different on different compilers.

So it is my guess something is wrong in the way you pass the filenames from C++;
anyway the above should be able to tell you what gets read.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Fixturized forever. Confused | :confused:


GeneralRe: Passing filename from C++ to Fortran Pin
Garth J Lancaster9-Dec-08 14:09
professionalGarth J Lancaster9-Dec-08 14:09 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 22:27
sitebuilderLuc Pattyn9-Dec-08 22:27 
GeneralRe: Passing filename from C++ to Fortran Pin
RedSonja9-Dec-08 20:52
RedSonja9-Dec-08 20:52 
AnswerRe: Passing filename from C++ to Fortran Pin
cp98769-Dec-08 15:03
cp98769-Dec-08 15:03 
GeneralRe: Passing filename from C++ to Fortran Pin
RedSonja9-Dec-08 20:46
RedSonja9-Dec-08 20:46 
GeneralRe: Passing filename from C++ to Fortran Pin
cp98769-Dec-08 21:03
cp98769-Dec-08 21:03 
GeneralRe: Passing filename from C++ to Fortran Pin
RedSonja9-Dec-08 21:53
RedSonja9-Dec-08 21:53 
GeneralRe: Passing filename from C++ to Fortran Pin
cp98769-Dec-08 22:50
cp98769-Dec-08 22:50 
GeneralRe: Passing filename from C++ to Fortran Pin
Luc Pattyn9-Dec-08 22:25
sitebuilderLuc Pattyn9-Dec-08 22:25 
AnswerRe: Passing filename from C++ to Fortran Pin
RedSonja11-Dec-08 20:13
RedSonja11-Dec-08 20:13 
QuestionWinInet Multithread Problems [modified] Pin
Julian Popov8-Dec-08 22:38
Julian Popov8-Dec-08 22:38 
QuestionIs it possible to have an array of types ? Pin
Defenestration8-Dec-08 22:20
Defenestration8-Dec-08 22:20 
AnswerRe: Is it possible to have an array of types ? Pin
Code-o-mat8-Dec-08 23:38
Code-o-mat8-Dec-08 23:38 
AnswerRe: Is it possible to have an array of types ? Pin
Defenestration8-Dec-08 23:43
Defenestration8-Dec-08 23:43 
GeneralRe: Is it possible to have an array of types ? Pin
Code-o-mat9-Dec-08 0:01
Code-o-mat9-Dec-08 0:01 
AnswerRe: Is it possible to have an array of types ? Pin
Defenestration9-Dec-08 0:12
Defenestration9-Dec-08 0:12 
GeneralRe: Is it possible to have an array of types ? Pin
Code-o-mat9-Dec-08 0:36
Code-o-mat9-Dec-08 0:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.