System Task $fgets 
Author Message
 System Task $fgets

Hi all,

I am having a query regarding $fgets(line, fd);
I have read the file completely and once the file is completely read,
I am getting an error message "$fgets : Argument 2 is an unknown file
descriptor."

How can i avoid this error message?

Since i am using Verilog-95 constructs, hence the system task $ferror
cannot be used, and $feof is also not possible as i am using Modelsim.
Is there any method by which i can block this error Message from the
code.

Regards
Kumar



Sat, 24 Dec 2005 13:25:53 GMT  
 System Task $fgets

Quote:

> Since i am using Verilog-95 constructs, hence the system task $ferror
> cannot be used, and $feof is also not possible as i am using Modelsim.

I just thought I would point out that $fgets is not a Verilog-1995
construct.  It was added to Verilog-2001 along with $ferror.  I don't
know why a $feof was not added at the same time.  I have already
proposed this to the IEEE as a possible enhancement.

$fgets will return 0 if it fails to read anything, due to an error
or presumably end of file.  This would be the most obvious way of
detecting that you have reached end of file.  However, Modelsim might
produce the error message at that time, so this might not allow you
to avoid it.  There are also some things you could do with $ftell and
$fseek, but that would be clumsy.



Sun, 25 Dec 2005 05:29:16 GMT  
 System Task $fgets

Quote:

> How can i avoid this error message?

You could also test for end of file before reading in another
way: use $fgetc to read a character and test the return value
for EOF (-1).  If it is not EOF, put it back with $ungetc and
proceed with your read.


Sun, 25 Dec 2005 07:10:30 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. question concerning fgets() - please help

2. Python 2.1 - tokenizer fgets crash (Windows)

3. fseek() and fgets()

4. FSF adds Clipper to GNU system task list

5. ANNOUNCE: Distributor (a task distribution system)

6. VHDL constructs equivalent to verilog system tasks

7. low level i/o system tasks

8. verilog queue systems tasks

9. System task status

10. more detail on system tasks needed

11. help - system tasks and functions

12. VHDL constructs equivalent to verilog system tasks

 

 
Powered by phpBB® Forum Software