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

Printing Greek characters with the print command

nkarampet
Beginner
1,150 Views
How can I print Greek characters with the print command and get Greek characters in the MS-DOS screen ?

PRINT*,"C oei? oi? I ??iae ="
0 Kudos
5 Replies
Jugoslav_Dujic
Valued Contributor II
1,150 Views
I don't think it's possible unless you set your system locale to Greek (Control Panel/Regional/Locale and Set default).
0 Kudos
Steven_L_Intel1
Employee
1,150 Views
If the characters you want aren't in the default console codepage, you can use the Win32 API routine SetConsoleCodepage to change the codepage, but only if you're running on NT/2000/XP and if you know the code number for the codepage you want.

Steve
0 Kudos
nkarampet
Beginner
1,150 Views
Dear Steve,
Thank you for your answer. Could you please explain to me by an example this approach.

Best regards

Nikos
0 Kudos
nkarampet
Beginner
1,150 Views
I have tried to follow your comments but it seems that it does not work. However, thank you for your time.

Best regards

Nikos
0 Kudos
tiborkibedi
Beginner
1,150 Views
I am also interested to display greek characters on the console. Here is a program (Fortran console application) which tries to load various output code pages found on the system. It was tested on a Win2000 Pro system, using CVF6.6a. It finds and loads nearly 50 code pages, but the output is displayed using the same code page of 437, which is the default on the system. Any idea, how to change the code page?
Use Kernel32
Implicit None
Character*6 Text
Integer*4 iCodePage
Integer*4 iRet
Logical*4 lRet
Integer*4 hConsoleOut
Integer*4 lpNumberOfCharsWritten 
Integer*4 lpReserved

hConsoleOut = GetStdHandle( STD_OUTPUT_HANDLE )

iCodePage = 0
Text = 'abcdef'
Do While (iCodePage < 100000)

  iCodePage = iCodePage + 1

  iRet = SetConsoleOutputCP(iCodePage)
  
  If ( iRet .gt. 0 ) Then
    Write (6,10000) iCodePage
    lret = WriteConsole( hConsoleOut, loc(Text),5, loc(lpNumberOfCharsWritten),Loc(lpReserved))
    Write(6,'(/)')
  End If

End Do

10000 Format(' iCodePage=',i6)

Stop
End
0 Kudos
Reply