I can not read character 0A in a bmp file with Compaq Visual Fortran 6.6C

In summary: I can not read character "0A" in a bmp file with "Compaq Visual Fortran 6.6C"In summary, the character 0A is a linefeed character, and the bmp file you are trying to read contains errors because of it.
  • #1
roy437
6
0
I can not read character "0A" in a bmp file with "Compaq Visual Fortran 6.6C"

Hi,

How to read character "0A" in a bmp file with "Compaq Visual Fortran 6.6C"
Here's an excerpt from bmp file:
42 4D 16 02 00 00 00 00 00 00 36 00 00 00 28 00
00 00 10 00 00 00 0A 00 00 00 01 00 18 00 00 00
Because the meeting this character appears error: "forrtl: severe (268): end of record during read, unit 1, file 16x10.bmp"

Thanks
 
Technology news on Phys.org
  • #2


it seems you are trying to read a binary file with an ascii read function or you've not opened the file as binary.

The 0A you mention is a linefeed character, commonly used to terminate lines of text in ascii files and stripped off when you read a line of text.

BMP files are images files (screen shots...) created on windows machines or by image editors that support that file type.
 
  • #3


What fortran interpreter?
 
  • #4


Here are some of the source code:

subroutine read_bmp_header(nfile, file_size, hpix, vpix)

! file_size - in bits
! hpix - numbers horizontal pixels
! vpix - numbers vertical pixels
! reading remains the first pixel

implicit none

character *54 header
character *8 fs, hm, vm
character *4 h

integer (2) i, j, nfile
integer (4) file_size, hpix, vpix

read(nfile, '(a)', advance = 'no') header
do i = 1, 4
j = 7 - i
h(i:i) = header(j:j)
j = 2 * i
write(fs(j-1:j), '(z2.2)') ichar(h(i:i))
j = 23 - i
h(i:i) = header(j:j)
j = 2 * i
write(hm(j-1:j), '(z2.2)') ichar(h(i:i))
j = 27 - i
h(i:i) = header(j:j)
j = 2 * i
write(vm(j-1:j), '(z2.2)') ichar(h(i:i))
end do

read(fs, '(z8)') file_size
read(hm, '(z8)') hpix
read(vm, '(z8)') vpix
return
end

Crashes when reading header !
 
  • #6


Where is your open() statement for nfile? That is what needs changed. You need FORM='BINARY' in the compaq fortran interpreter.
 
  • #7


Here is the calling unit:

implicit none

integer (4) file_size, hpix, vpix
integer (2) k, l, m

character *100 fisi
character *54 header
character *1, allocatable :: r(:), g(:), b(:)

open(1, file = fisi)

call read_bmp_header(int2(1), file_size, hpix, vpix)
 
  • #9


justsomeguy said:
What fortran interpreter?

FORTRAN is interpreted?
 
  • #10


Borek said:
FORTRAN is interpreted?

Yeah, I had the same question. I think he must be using the word in the English language sense, not the computer science sense.
 
  • #11


Using it in the "vmware is melting my brain in another window" sense. Apologies.
 
  • #12


Thank you very much to jedishrfu and justsomeguy !
 

1. Why am I getting an error when trying to read character 0A in a bmp file with Compaq Visual Fortran 6.6C?

This error may be due to the fact that character 0A is a line feed character, which may not be supported by the specific version of Compaq Visual Fortran you are using. It is recommended to consult the documentation or contact the software developer for further assistance.

2. Can I use a different version of Compaq Visual Fortran to read character 0A in a bmp file?

Yes, it is possible that other versions of Compaq Visual Fortran may support the reading of character 0A in a bmp file. It is recommended to try using a different version or consult with the software developer for further guidance.

3. Is there a way to bypass the error when trying to read character 0A in a bmp file with Compaq Visual Fortran 6.6C?

There may be workarounds or alternative methods to read character 0A in a bmp file with Compaq Visual Fortran 6.6C, but these may vary depending on your specific code and situation. It is recommended to consult with the software developer or seek assistance from a fellow programmer.

4. Can other programming languages read character 0A in a bmp file?

Yes, it is possible that other programming languages may have the capability to read character 0A in a bmp file. It is recommended to explore alternative programming languages if you are unable to read character 0A with Compaq Visual Fortran 6.6C.

5. Is there a specific reason why character 0A cannot be read in a bmp file with Compaq Visual Fortran 6.6C?

The reason for this error may vary and is dependent on the specific version and settings of Compaq Visual Fortran 6.6C. It is recommended to consult the documentation or contact the software developer for further insight.

Similar threads

Replies
58
Views
3K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
2
Views
277
  • Engineering and Comp Sci Homework Help
Replies
12
Views
2K
  • General Engineering
Replies
20
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
1K
  • Programming and Computer Science
Replies
2
Views
16K
  • Computing and Technology
Replies
4
Views
3K
  • Programming and Computer Science
Replies
4
Views
4K
Back
Top