Clear Screen - Fortran

This is a discussion on Clear Screen - Fortran ; 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. ...

+ Reply to Thread
Results 1 to 7 of 7

Clear Screen

  1. Default Clear Screen

    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


  2. Default Re: Clear Screen

    Rosana Khan <khanrosana> 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

  3. Default Re: Clear Screen

    On Jul 30, 8:48 pm, Rosana Khan <khanros...> 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


  4. Default Re: Clear Screen


    > > 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.



    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


  5. Default Re: Clear Screen


    "Rosana Khan" <khanrosana> wrote in message
    news:1185865310.116968.77060@e9g2000prf.googlegroups.com...
    >
    >> > 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.

    >
    >
    > 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



  6. Default Re: Clear Screen

    On Jul 31, 12:01 am, Rosana Khan <khanros...> 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


  7. Default Re: Clear Screen

    On Mon, 30 Jul 2007 20:58:57 -0700, nospam@see.signature (Richard
    Maine) wrote:

    > Rosana Khan <khanrosana> wrote:

    <snip: to clear screen>
    > > WRITE(*,*) CHAR(27), '[2J'

    <snip>
    > 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

+ Reply to Thread

Similar Threads

  1. extension to idle to clear screen - but how to write to screen?
    By Application Development in forum Python
    Replies: 2
    Last Post: 11-22-2007, 11:16 AM
  2. FAQ 8.7 How do I clear the screen?
    By Application Development in forum Perl
    Replies: 0
    Last Post: 10-31-2007, 02:03 AM
  3. Re: clear shell screen
    By Application Development in forum Python
    Replies: 1
    Last Post: 10-30-2007, 12:34 AM
  4. Re: clear shell screen
    By Application Development in forum Python
    Replies: 0
    Last Post: 10-29-2007, 06:20 PM
  5. FAQ 8.7 How do I clear the screen?
    By Application Development in forum Perl
    Replies: 0
    Last Post: 06-09-2007, 08:03 PM