- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone,
I'm having troubles recently when writing data in files with my fortran programs.
I don't know if it comes from the network or anything else, but it is quite annoying because my team is working exclusively with these kinds of programs.
I am making standard use of open and write (at least it was working very well a few monthes ago)
open (IUREL, FILE=RELFILE, FORM='UNFORMATTED', STATUS='UNKNOWN')
write(IUREL) i_passages , i_zones
IUREL being an integer of free logical unit and RELFILE being a character for the name of the file required, i_passages and i_zones some of the data I want to write.
When RELFILE is located on the computer (on drive C: for example), write a file of 60Mo takes a few seconds.
Otherwise, if RELFILE is a location on the company network, the same data will require randomly (apparelntly) either a few seconds, or up to 30 minutes.
As I cannot figure out why, I thought maybe I can modify my programs so they write the data locally in a temporary file, and then transfer the file at the required location on the network.
If possible, how can I do that ? Is there a Fortran intrinsic function that already does that ?
Thanks in advance.
Cheers,
Renaud
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's probably an issue with your network file system. You can open a temporary file using STATUS='SCRATCH', but once you close it it will be gone. You can REWIND it and then read and write, though I am not sure that will help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
I guess the problem is indeed on the network file system, but I have no access to it, so I have to work another way. I already asked the IT department to have a look at it, but nothing abnormal to them.
I already thought using SCRATCH but eventually I'll have to write the same amount of data on the network, causing traffic falloff.
Here's what I did, seems to do the trick for now
open (newunit=ul, file = fileName) !opens a "temporary" file on local drive (on execution path)
do i=1, 1000000 !writes large amount of data
write(ul, *) 1D30, 1D30, 1D30
enddo
call system ('copy "'// fileName //'" "'// filePath // '"') !copies the local file on the network
close(ul)
call system ('del "' // fileName //'"') !deletes the local file
This method takes short time, so I guess I'll stick with that since there's no fortran embeded function able to do that.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You cam use the Windows API routine CopyFile to do the file copy. There's a worked example provided under the Samples folder in the Win32 ZIP file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I gave a look to Win32 API for CopyFile, but I have more difficulties using it than using simple cmd system function.
After a few days of use, I no longer have problems of writing time.
Thanks for your advice !
Ren

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page