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

writing on a fixed line into a console

tropfen
Nouveau contributeur I
529 Visites
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 Compliments
3 Réponses
Les_Neilson
Précieux contributeur II
529 Visites

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

Does this do what you want?

Les

0 Compliments
jparsly1
Nouveau contributeur I
529 Visites

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 Compliments
tropfen
Nouveau contributeur I
529 Visites
Hello Les,

yes.

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

Frank
0 Compliments
Répondre