Usage of $fwrite function for onfly logging data

Hi,

I am using below $fwrite option to log the data

$fwrite(out_result,“%h”, packet_data[i]," ");

question: I am not seeing on-fly duping of data, only after $finish hit it will display the data

how to make on-fly dumping of data during the simulation?

I have tried to use below switches also, no use

“r” or “rb”

Open for reading

“w” or “wb”

Truncate to zero length or create for writing

“a” or “ab”

Append (open for writing at end of file)

“r+”, “r+b”, or “rb+”

Open for update (reading and writing)

“w+”, “w+b”, or “wb+”

Truncate or create for update

“a+”, “a+b”, or “ab+”

Append; Open or create for update at end-of-file

thanks
Chethan M

In reply to chethan malleshappa1:

The $fwrite() function will cache data for performance reasons. You can flush the output fd using the $fflush(fd) function.