Hi, I am trying to open a file that has its name starting with a digit; both functions fail. If I add a letter to the beginning of the name, they work. Is there any workaround this? I can't change the filenames. Regards, Rudnei
Problem with file name in GET_DIB_INFO@ and GET_DIB_BLOCK@
Rudnei
I don't know how you can fix this but if you can send a sample program and dib file then we can probably make these functions work for you.
Dear Paul,
Sure, here it is.
[img]https://drive.google.com/file/d/1y_7llieOQXM3Tg1qAnFtFvTr5DLaLMgV/view?usp=sharing[/img]
[img]https://drive.google.com/file/d/1llheehFRn8qYGOn5uudMTub6ibpa7x9c/view?usp=sharing[/img]
And the program:
winapp
program test_dib
implicit none
include <windows.ins>
integer :: ctrl,hres,vres,no_de_bits,rslt
character,dimension(:,:,:),allocatable :: pixels
character(len=80) :: message,filename
filename='001.jpg' ! ⇐= will fail on get_dib_size@ and get_dib_block@
filename='a001.jpg' ! ⇐= filename starting with a letter works ok!
call get_dib_size@(filename,hres,vres,no_de_bits,rslt)
if (rslt/=0) then
call dos_error_message@(rslt,message)
print *,message
else
allocate(pixels(3,hres,vres),stat=rslt)
if (rslt/=0) then
print *,'Error while trying to allocate image array.'
else
call get_dib_block@(filename,pixels,hres,vres,0,0,hres,vres,0,0,rslt)
if (rslt/=0) then
call dos_error_message@(rslt,message)
print *,message
else
rslt=winio@('%ww%ca[Image]&')
rslt=winio@('%gr[black,rgb_colours]&',hres,vres)
rslt=winio@('%lw',ctrl)
call display_dib_block@(0,0,pixels,hres,vres,0,0,hres,vres,0,0,rslt)
end if
end if
end if
end program test_dib
Cheers Rudnei
rudnei
You can get this code to work by by using:
filename='.\001.jpg'
Dear Paul, Many thanks, tested and it works! Cheers Rudnei
ClearWin+ has now been fixed so that this work-around will not be needed in the future.