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

In summary, the person is asking for help with using Fortran to put an output file from a program into a network path. They are requesting commands in Fortran to do this and someone suggests mapping a network path to a drive in windows.
  • #1
socorroros
1
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
  • #2
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
 
  • #3
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/
 

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

1. How do I specify the network path in Fortran f90?

To specify the network path in Fortran f90, you will need to use the OPEN statement. The syntax for specifying the network path is "//server/sharename/filename". Make sure to include the double forward slashes at the beginning of the path.

2. Can I use relative paths for network locations in Fortran f90?

Yes, it is possible to use relative paths for network locations in Fortran f90. This can be achieved by using the "./" notation at the beginning of the path. For example, if your file is located in a folder called "data" on the network, you can specify the path as "./data/filename".

3. How do I check if the file has been successfully saved to the network path?

You can use the INQUIRE statement to check if the file has been successfully saved to the network path. The INQUIRE statement allows you to check for the existence of a file and also retrieve information about the file, such as its size and last modification date.

4. What happens if the network path is not accessible?

If the network path is not accessible, Fortran will throw an error and the file will not be saved. It is important to ensure that the network path is accessible before attempting to save the file. You can also use the INQUIRE statement to check if the network path is accessible before attempting to save the file.

5. How do I close the file after saving it to the network path?

To close the file after saving it to the network path, you can use the CLOSE statement. This will free up any resources associated with the file and ensure that it is properly saved to the network path.

Similar threads

  • Programming and Computer Science
Replies
1
Views
875
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
2
Replies
59
Views
9K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
1
Views
2K
Replies
19
Views
2K
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
29
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
Back
Top