For Programmers: Free Programming Magazines  


Home > Archive > Fortran > November 2004 > No Linefeed on Text Screen using Backspace?









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]

 

Author No Linefeed on Text Screen using Backspace?
Christian Hoffmann

2004-11-25, 3:57 pm

Hello,

....well, I'm not a Fortran Crack.

Does anybody know a way to make Fortran Programs NOT to
send CR/LF when writing text to a screen? (Similar as
write('#') in Pascal would do or PRINT"#"; in Basic?

WRITE(6,FMT='(I7)' ) ITOTDO
BACKSPACE(6)

Is not working, the program crashes:

500
backspace: can't backspace file
apparent state: unit 6 (unnamed)
lately writing sequential formatted external IO
8 [sig] gen_source 1692 open_stackdumpfile: Dumping stack trace to
my_program.exe.stackdump

I'm currently using g77 in a Windows/Cygwin environment.


Regards,

Christian

Michael Metcalf

2004-11-25, 3:57 pm


"Christian Hoffmann" <brcwcs@gmx.net> wrote in message
news:30mejcF33jv2tU1@uni-berlin.de...

WRITE(6,FMT='(I7)' , advance = 'no' ) ITOTDO

Regards,

Mike Metcalf


Christian Hoffmann

2004-11-26, 9:02 am



Michael Metcalf wrote:
> WRITE(6,FMT='(I7)' , advance = 'no' ) ITOTDO
>
> Regards,
>
> Mike Metcalf
>
>

Hi Mike,

unfortunately my cygwin-g77 doesn't like it:

my_program.F: In subroutine `my_program1':
my_program.F:687:
WRITE(6,FMT='(TR5,I7)',advance='no') ITODO
^
Unsupported WRITE control item at (^) -- ADVANCE= and EOR= are not

supported
make: *** [my_program.obj] Error 1

The only way I found is to use an ESCAPE-Sequence like that:

WRITE(6,FMT='(A1,"[A",I7)') char(27),ITODO

which is a bit slower but working. Maybe there is more intelligent way...

Regards

Christian

Michael Metcalf

2004-11-26, 9:02 am


"Christian Hoffmann" <brcwcs@gmx.net> wrote in message
news:30o6aaF3290bgU1@uni-berlin.de...
> which is a bit slower but working. Maybe there is more intelligent way...
>

There is: use g95, see www.g95.org.

Regards,

Mike Metcalf


bud davis

2004-11-26, 4:09 pm

Use the '$' format descriptor, which is available in g77:


$ cat x.f
write(*,'(A15$)')'this is line 1'
write(*,*)' and so is this'
end
$ g77 x.f
$ ./a.out
this is line 1 and so is this



HTH,
bud davis
Richard Maine

2004-11-26, 4:09 pm

Christian Hoffmann <brcwcs@gmx.net> writes:

> unfortunately my cygwin-g77 doesn't like it:


That's because it is a f77 compiler. Advance="no" was standardized
in f90. There is no standard or portable way in f77. For details,
See many past threads on the same question, but mostly you will
find material about the various tricks that work with various
f77 compilers; there is none that will work in all f77
environments.

You escape sequences certainly are among the tricks that will not
work in all environments, but do work in some. If they work for
the environment you need, then I guess you have your answer; just
be aware that it won't work everywhere. Take whatever cautions
seem appropriate to separate it out as a potential porting issue.

--
Richard Maine
email: my last name at domain
domain: summertriangle dot net
Christian Hoffmann

2004-11-29, 4:07 pm



Thanks for your hints!

Regards,

Christian

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com