zoex666
Newbie level 1
Hi evrybody, this is my first post. I'm newbye in Systemverilog. The following code doesn't work:
The compilation is ok, but when I run it I get the following errors:
# ** Error: (vsim-PLI-3084) C:/Users/../files_io.sv(8): $feof : Argument 1 is not a valid file descriptor.
# Region: /files_io
# ** Error: (vsim-PLI-3084) C:/Users/../files_io.sv(10): $fgets : Argument 2 is not a valid file descriptor.
Thanks in advance for you attention.
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 module files_io(); initial begin int fileid = $fopen("text.txt"); if(!fileid) $display("ERROR: CAN NOT OPEN THE FILE!"); while(!$feof(fileid)) begin string line; if($fgets(line,fileid)) $display(line); end $fclose(fileid); end endmodule
The compilation is ok, but when I run it I get the following errors:
# ** Error: (vsim-PLI-3084) C:/Users/../files_io.sv(8): $feof : Argument 1 is not a valid file descriptor.
# Region: /files_io
# ** Error: (vsim-PLI-3084) C:/Users/../files_io.sv(10): $fgets : Argument 2 is not a valid file descriptor.
Thanks in advance for you attention.
Last edited by a moderator: