Home > Archive > Fortran > August 2007 > Clear Screen
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Rosana Khan 2007-07-31, 4:20 am |
| Dear All,
I am having some trouble with clearing screen. I can't find any way to
do this in Fortran.
Documents from http://www.ibiblio.org say that
WRITE(*,*) CHAR(27), '[2J'
statement will clear the screen. But it is not working for me. I used
CALL SYSTEM('cls') or CALL system('clear'); but I dont like the idea.
Is there any other way in Fortran to do that?
Another thing - How can I access printer from a Fortran program?
Regards
Rosana
| |
| Richard Maine 2007-07-31, 4:20 am |
| Rosana Khan <khanrosana@gmail.com> wrote:
> I am having some trouble with clearing screen. I can't find any way to
> do this in Fortran.
That's because it is not a Fortran matter.
> Documents from http://www.ibiblio.org say that
>
> WRITE(*,*) CHAR(27), '[2J'
>
> statement will clear the screen. But it is not working for me. I used
> CALL SYSTEM('cls') or CALL system('clear'); but I dont like the idea.
> Is there any other way in Fortran to do that?
It depends on your specific sytem and compiler. There is no general way.
The first method you showed depends on the system accepting ANSI X.25
terminal escapes. Some systems do. Some don't. For a while it was fairly
common, but it seems to be becomming less so in some systems (notably
Windows).
> Another thing - How can I access printer from a Fortran program?
Same thing. This isn't a Fortran matter. Fortran doesn't know about
specific hardware devices like terminal screens and printers. (Neither
do most other languages). The details depend entirely on your specific
system. Some systems have special device names that you can write to to
print. Details vary. However, it is generally more portable to write the
output to an ordinary file and then execute appropriate system commands
to print that file. The system commands for that will vary.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
| |
| Steve Lionel 2007-07-31, 4:20 am |
| On Jul 30, 8:48 pm, Rosana Khan <khanros...@gmail.com> wrote:
> I am having some trouble with clearing screen. I can't find any way to
> do this in Fortran.
> Documents fromhttp://www.ibiblio.orgsay that
>
> WRITE(*,*) CHAR(27), '[2J'
>
> statement will clear the screen. But it is not working for me. I used
> CALL SYSTEM('cls') or CALL system('clear'); but I dont like the idea.
> Is there any other way in Fortran to do that?
That code assumes ANSI control sequence support. You don't say what
OS (or compiler) you are using, but for Windows, Microsoft dropped
support for ANSI control in Windows NT and later 32-bit versions of
Windows (2000, XP, Vista). If the system calls you are using do what
you want, that's probably the easiest solution.
> Another thing - How can I access printer from a Fortran program?
Here again it would be helpful to know the OS and compiler. Gone are
the days where one could just write to LPT: and print something.
Today's bitmapped printers require some sophisticated code to render
the output.
Intel Visual Fortran for Windows provides a sample application that
demonstrates how to do this - it includes a callable routine that will
use the Windows print mechanism to print the contents of a text file,
with lots of control over spacing, page length, font and more.
Steve
| |
| Rosana Khan 2007-07-31, 4:20 am |
|
>
> Here again it would be helpful to know the OS and compiler. Gone are
> the days where one could just write to LPT: and print something.
> Today's bitmapped printers require some sophisticated code to render
> the output.
>
> Intel Visual Fortran for Windows provides a sample application that
> demonstrates how to do this - it includes a callable routine that will
> use the Windows print mechanism to print the contents of a text file,
> with lots of control over spacing, page length, font and more.
Thanks for the reply.
I am using intel visual fortran for windows and g95 and gfortran for
cygwin. Can I get some help?
Thanks and Regrads
Rosana
| |
| Wade Ward 2007-07-31, 4:20 am |
|
"Rosana Khan" <khanrosana@gmail.com> wrote in message
news:1185865310.116968.77060@e9g2000prf.googlegroups.com...
>
>
>
> Thanks for the reply.
>
> I am using intel visual fortran for windows and g95 and gfortran for
> cygwin. Can I get some help?
do i = 1, 30
write (*,*)
end do
--
WW
| |
| Steve Lionel 2007-07-31, 7:09 pm |
| On Jul 31, 12:01 am, Rosana Khan <khanros...@gmail.com> wrote:
>
> I am using intel visual fortran for windows and g95 and gfortran for
> cygwin. Can I get some help?
I can help with Intel Visual Fortran, not with the others.
For printing, see the Samples\Miscellaneous\WinPrint sample installed
with the 10.0 compiler. This includes the source of a module that
provides a routine Print_Unit. You don't need to edit or even
understand the source - just add it to your project, add a USE of the
module and call Print_Unit specifying the unit number to which you
have written the text file you want printed. By default, it will
print the text using "Courier New" font on your default printer. Read
the source of the routine for a description of optional arguments.
As I suggested earlier, "clearing the screen" isn't exactly meaningful
when your "screen" is a scrolling window. What exactly are you trying
to accomplish? What is your application and what purpose does
clearing the screen have?
Steve
| |
| David Thompson 2007-08-26, 4:27 am |
| On Mon, 30 Jul 2007 20:58:57 -0700, nospam@see.signature (Richard
Maine) wrote:
> Rosana Khan <khanrosana@gmail.com> wrote:
<snip: to clear screen>
<snip>[color=darkred]
> It depends on your specific sytem and compiler. There is no general way.
> The first method you showed depends on the system accepting ANSI X.25
> terminal escapes. <snip>
X3.64. Or perhaps DEC VT100/etc, which were _largely_ the same.
I don't recall X3.25 myself; googleweb says it was parallel interface.
CCITT (now ITU-T) X.25 is packet-switched data networking. (Roughly
comparable to the IP level in the Internet.)
- formerly david.thompson1 || achar(64) || worldnet.att.net
|
|
|
|
|