Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29393 ディスカッション

FOR_READ and FOR_PRINT

kompute
ビギナー
990件の閲覧回数
Can anyone illustrate how to read and write to a file in another directory instead of the current one using FOR_READ and FOR_PRINT?
0 件の賞賛
6 返答(返信)
Steven_L_Intel1
従業員
990件の閲覧回数
Wouldn't it be simpler to OPEN the desired file and specify the unit number you opened in READ and WRITE statements?
kompute
ビギナー
990件の閲覧回数

I have tried using the following statement but the iostat is 29 which seems to be a file not found error.

open (unit=101,file='C: est est',form='BINARY',
+ status='REPLACE',iostat=ret)

The executable is in directory C: est2 est3 est4.

Steven_L_Intel1
従業員
990件の閲覧回数
Take out the iostat and what error gets displayed. Does this file not have a file type? Is C: est est a directory? If so you need a full file specification.
kompute
ビギナー
990件の閲覧回数

With the iostat removed and C: est est.txt (is a full file specification) for clearer illustration. The following errors are displayed:

=================================================

C:Fortran CompilerIntel Visual FortranV9SamplesConsole1Debug>Console1
forrtl: severe (29): file not found, unit 101, file C: est est.txt
Image PC Routine Line Source
Console1.exe 00451F32 Unknown Unknown Unknown
Console1.exe 0044F1C8 Unknown Unknown Unknown
Console1.exe 00407C3A Unknown Unknown Unknown
Console1.exe 00407867 Unknown Unknown Unknown
Console1.exe 004018E1 Unknown Unknown Unknown
Console1.exe 0040107B _MAIN__ 21 Console1.f90
Console1.exe 004585C0 Unknown Unknown Unknown
Console1.exe 00439F60 Unknown Unknown Unknown
kernel32.dll 7C816FD7 Unknown Unknown Unknown

=================================================

Probably theenvironment is not pathed to the correct directory.

Steven_L_Intel1
従業員
990件の閲覧回数
The environment isn't relevant here. You will get this error if the directory C: est does not exist.
kompute
ビギナー
990件の閲覧回数
oops... my error. Thanks for your help.
返信