$fopen usage leads to 'Too many open files' error

Thanks I can try that.

Actually I should note that there are indeed multiple modules with this code. Each module instance will create its own uniquely-named file on

negedge rstb

. The number of modules depends on the test but could get up to something like 64. A quick google search suggests the limit on $fopen is 32 at a time. Is this correct?