Guest
Hi
I am trying to read one file using $fscanf. But eventhough End of file
is reached, if i tried to read it will displaly the last data which it
got while fscanf. How i will know EOF is reached.
For example
x.log has follwing data
987cba
187cba
927cba
983cba
9874ba
If i tried to read above code using following block.
initial
begin
r4 = $fopen("x.log","r");
for (i = 0 ; i < 10; i = i + 1)
begin
t2 = $fscanf(r4,"%h",vr);
$display("%h",vr);
end
i will get follwing output
# 987cba
# 187cba
# 927cba
# 983cba
# 9874ba
# 9874ba
# 9874ba
# 9874ba
# 9874ba
# 9874ba
Eventhogh EOF is reached, it will display the last scanf. How i will
know i have reached while using $fscanf
I am trying to read one file using $fscanf. But eventhough End of file
is reached, if i tried to read it will displaly the last data which it
got while fscanf. How i will know EOF is reached.
For example
x.log has follwing data
987cba
187cba
927cba
983cba
9874ba
If i tried to read above code using following block.
initial
begin
r4 = $fopen("x.log","r");
for (i = 0 ; i < 10; i = i + 1)
begin
t2 = $fscanf(r4,"%h",vr);
$display("%h",vr);
end
i will get follwing output
# 987cba
# 187cba
# 927cba
# 983cba
# 9874ba
# 9874ba
# 9874ba
# 9874ba
# 9874ba
# 9874ba
Eventhogh EOF is reached, it will display the last scanf. How i will
know i have reached while using $fscanf