View previous topic :: View next topic |
Author |
Message |
eugenea
Joined: 14 May 2007 Posts: 2
|
Posted: Wed May 16, 2007 3:21 pm Post subject: problems with screen output |
|
|
I have a program that used to run OK with UNIX compilers, but I am having some problems moving it to Windows using Silverfrost F95.
I've ironed out most of the errors - they were my fault (my previous compilers were too permissive and allowed some bad practices; Silverfrost is more strict, and justly so).
But there is one last (hopefully!) problem I just cannot solve. The software does not want to print to screen from subroutines (it does from the core program), saying "error 94: unit neither has been OPENed nor preconnected".
I don't want to disable screen output; I need to monitor that things are OK. How can I open or preconnect screen output? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed May 16, 2007 4:34 pm Post subject: |
|
|
You do not need to open or preconnect.
Just use PRINT or WRITE(2, ...) or WRITE(6, ....) |
|
Back to top |
|
|
eugenea
Joined: 14 May 2007 Posts: 2
|
Posted: Wed May 16, 2007 4:41 pm Post subject: Re: |
|
|
PaulLaidler wrote: | You do not need to open or preconnect.
Just use PRINT or WRITE(2, ...) or WRITE(6, ....) |
It's PRINT that is causing the problem. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed May 16, 2007 6:47 pm Post subject: |
|
|
Can you post a small program here to illustrate the problem? |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Thu May 17, 2007 12:10 pm Post subject: Printing problems |
|
|
Try avoiding low unit numbers for your normal i/o, if you open a file with unit 1, 2 .. 6 etc, then this may overrule the standard preconnections. Closing them afterwards may not restore the preconnections. I always start my i/o unit numbers at 10.
Just a suggestion.
Ian |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Fri May 18, 2007 12:17 am Post subject: |
|
|
To write to the screen, you can simply use the following format defined or free format, or any expansion of these.
write (*,1001) 'string and number ',i
1001 format (a,i0)
write (*,*) 'string and number ',i
I use these in both a cmd.exe DOS box or clearwin+, without any problems.
You may also use units 1 or 6, as these are the default output.
write (1,1001) 'string and number ',i
If these are not working, make sure you don't open a file on units 1-7, in case of any legacy unit issues. I start opening files from unit 11.
I hope this relates to your problem. |
|
Back to top |
|
|
|