LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-14-2003, 11:07 AM   #1
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
Need help defining Fortran 77 input/output streams using g77!


I'm currently trying to compile some fairly old VAX Fortran 77 code using g77. It all seems to be working except for one big problem: the program relies on input/output streams linked to files. I'm afraid I know very little about Fortran, but I believe this is referred to as an input/output unit - each file is associated with an integer, and then when the file is written to/read from, the Fortran code merely refers to the number (in exactly the same way that '5' is the unit for standard input and '6' is for standard output). Sorry if you feel I'm insulting your intelligence, I'm trying to get it straight in my head!
My big problem is, I don't know how to assign the file paths/names to the units. Is this done inside the program listing, or inside the Makefile, or both? What's the syntax?

This is probably a very simple question, but I'm not a Fortran programmer myself (I write C++ usually!) and I've found it totally impossible to discover the answer on the net or in the manual...

Your help would be greatly appreciated!
 
Old 08-14-2003, 12:42 PM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
hopefully this gives the general idea, it attaches unit 10 to /tmp/file, writes Hello to it, then closes it.
Code:
open(10,file='/tmp/file')
write(10,*) 'Hello'
close(10)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
g77 Fortran - run time error (fmt: read unexpected character) rajeshdorai Programming 1 08-16-2006 07:07 AM
fortran debugging question with g77 and gdb miasmak Programming 1 08-16-2006 07:03 AM
Fortran compiler gcc-g77 installation problem refp16 Linux - Software 6 11-26-2005 12:49 PM
compile( gcc-g77) fortran with fedora core 3 gambato79 Programming 1 05-06-2005 12:49 PM
G77 Fortran included in Fedora 2 ? aeslin Linux - Software 1 11-08-2004 07:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration