I was trying to read values from a file using command
r=$sscanf(line,“%s %f”,fruit,number);
let the file be
apple 5.2
orange 6.1
when i use the following command
$display(" apple = %f",number);
I’m getting
apple = 5.000000
when I’m expecting
apple = 5.2
Can anyone please help me?
In reply to Adarsh Santhosh:
Type of the values inside the file has to be real .
In reply to saurabh_3:
I didnt get you.
Can u pls explain?
In reply to Adarsh Santhosh:
What is the declaration of
number?
In reply to Adarsh Santhosh:
Why do you expect the fractional part of a real number to be stored in a integral variable?
In reply to dave_59:
Oh then I should use real?