zoex666
Newbie level 1
- Joined
- Oct 6, 2012
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,299
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: