In reply to dave_59:
Hi Dave,
As $fgetc doesn’t give the input data in correct format i used $fscanf.
The file actually contains 1440000 bytes (8006008). The positive thing is , now it reads all the data
and goes beyond it. So now i have to check the counter value. Why it doesn’t find the EOF?
I have read the same image using VHDL which uses EOF file checking. So we can conclude the file is not corrupt with EOF.
i changed the code
function void image_file_read();
count = 0;
while (data_byte != -1)
begin
file_status = $fscanf(input_file,“%h”,data_byte);
count++;
$display(“%d %h”,count,data_byte);
if(count == 1440000)
$finish;
//$fwrite(output_file,read_char);
end
$fclose(input_file);
endfunction : image_file_read