Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29238 Discussions

writing on a fixed line into a console

tropfen
New Contributor I
527 Views
Hello,

is it possible to write on a fixed position into a console line? (Meaning no new line for each write(6,...))

If yes how?

Thanks in advance
Frank
0 Kudos
3 Replies
Les_Neilson
Valued Contributor II
527 Views

Have a look at the WRITE with Advance=NO option.

Does this do what you want?

Les

0 Kudos
jparsly1
New Contributor I
527 Views

Here's one way using some of the routines provided with CVF. The GOTOXY

routine allows you to set the cursor position in the console window.Probably works

with IVF too, although the USE statements might be a little different...

call gotoxy(10,20)
write(*,*) 'row 10 column 20'
call gotoxy(20,10)
write(*,*) 'row 20, column 10'
read(*,*) ii
stop
end


subroutine gotoxy(irow,icol)
use dflib
use dfwin
integer fhandle
logical lstat
Type(T_COORD) wpos
fhandle = GetStdHandle(STD_OUTPUT_HANDLE)
wpos.x = icol
wpos.y = irow
lstat = SetConsoleCursorPosition(fhandle, wpos)

return
end

0 Kudos
tropfen
New Contributor I
527 Views
Hello Les,

yes.

Your way will do it in 99% of the problems.

Frank
0 Kudos
Reply