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

Intel Fortran v. 11 generates 3 nul characters between each letter

Sharon_Pfeiffer
Beginner
716 Views
I think there is a bug with the IFort v.11. I wrote a simple code to translate a binary file to an ascii file but it generates 3 nul characters between each letter.
But whenI compile the code with gfortran, it works.

Here is the code:

program main

implicit none

Character :: Text =""

Open ( Unit = 99 , &

File = "sp.txt" , &

Access = "Direct" , &

Action = "WRITE" , &

Form = "Unformatted" , &

RecL = 1 , &

Status = "REPLACE" )

Write(Unit = 99, Rec=1) "A"

Write(Unit = 99, Rec=2) "B"

Text = "W"

Write(Unit = 99, Rec=3) TEXT

Text = "X"

Write(Unit = 99, Rec=4) TEXT

close(99)

end program main

0 Kudos
3 Replies
Steven_L_Intel1
Employee
716 Views
RECL=1 has a different meaning in Intel Fortran than in gfortran - by default, unformatted RECL is in units of "numeric storage units" or 4 bytes. Add:

-assume byterecl

and you'll get what you want.
0 Kudos
Lucas_M_
Beginner
716 Views
Hi, I am similar issue however the code don't use recl. The code: IRECLTH = 1 I make it with: makefile:FFLAGS = -O3 -g -r8 -i8 -openmp -assume byterecl -convert big_endian Binary file thinmxmn matches However the the SP sometime replaced as nul and lf become nl. What should I do to fix it? Thank you very much. Kenny
0 Kudos
Steven_L_Intel1
Employee
716 Views
I assume your code has more than that one assignment statement. Can you show a small but complete program that demonstrates the problem? if you can attach a .tar of the binary file, that would help too.
0 Kudos
Reply