Silverfrost Forums

Welcome to our forums

problems with screen output

16 May 2007 2:21 #1935

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?

16 May 2007 3:34 #1936

You do not need to open or preconnect. Just use PRINT or WRITE(2, ...) or WRITE(6, ....)

16 May 2007 3:41 #1937

Quoted from PaulLaidler 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.

16 May 2007 5:47 #1938

Can you post a small program here to illustrate the problem?

17 May 2007 11:10 #1939

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

17 May 2007 11:17 #1940

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.

Please login to reply.