Fortran How to put a output file in a network path with Fortran f90

Click For Summary
To redirect output files generated by a Fortran f90 program to a network path, users can specify the desired network path directly in the OPEN statement. For example, instead of using a local path like 'C:\$User\OUT.TXT', the command can be modified to use a network path such as '\\server_name\resource_shared\OUT.TXT'. Additionally, mapping the network path to a drive letter in Windows can simplify access, allowing users to refer to the mapped drive in their Fortran code. Resources for mapping network drives are available online for further guidance.
socorroros
Messages
1
Reaction score
0
Hello Folks

I have a program code in Fortran f90, that program generate an output file and put that into the same directory where the program resides, I need to put that output file in a network path ex: \\server_name\resource_shared

I will appreciate if you could provide me the commands in fortran to do this

Thank you very much in advance and regards
 
Technology news on Phys.org
You can specify the path when declaring the output device, so I'd think the path could be a network drive.

PROGRAM OUT_FILE_TEST
OPEN (12,file='C:\$User\OUT.TXT')
WRITE (12,*) 'This is a test writing to C:\$User\OUT.TXT'
CLOSE (UNIT=12)
END PROGRAM OUT_FILE_TEST
 
socorroros said:
Hello Folks

I have a program code in Fortran f90, that program generate an output file and put that into the same directory where the program resides, I need to put that output file in a network path ex: \\server_name\resource_shared

I will appreciate if you could provide me the commands in fortran to do this

Thank you very much in advance and regards

Hey socorroros and welcome to the forums.

One thing that you can do is to map a network path to a drive. You can do this in windows. Something like this should help:

http://www.linglom.com/2008/09/28/how-to-map-a-network-drive-on-windows/
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
Replies
1
Views
5K
  • · Replies 59 ·
2
Replies
59
Views
11K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 29 ·
Replies
29
Views
6K