This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: help please
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: Zhang Wang <wang01_99 at yahoo dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 03 Jul 2002 22:47:03 +0200
- Subject: Re: help please
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <20020703202929.75952.qmail@web9107.mail.yahoo.com>
Zhang Wang wrote:
> I am trying to figure out how to pass an array to a subroutine to
> write results to a file. My program is just for testing and it does
> not work. If I remove the open file and subroutine parts, it works
> fine to output on the screen. The attachment is my program. Please
> help me to fix it.
>
> Your help is greatly appreciated!
[ code snipped ]
I don't understand your question. Using GCC/g77-3.1, your program works
perfectly. It displays:
1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
2 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
and deposits:
1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
2 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
in the file SUB.DAT (which you opened on unit 3).
What's wrong with that ?
[ Note that if you try it a second time without removing SUB.DAT, the
program would report:
open: 'new' file exists
apparent state: unit 3 named SUB.DAT
lately writing direct unformatted external IO
because you are not supposed to open a file with STATUS='NEW' when
it already exists (use 'OLD' or 'UNKNOWN') ]
Hope this helps,
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)