$fopen();$fclose();$feof();$fgets;fdisplay();fwrite();
module readfile ;
integer STR_CNT ;
integer FILE_RD;
integer FILE_WR;
reg [47:0] CHAR ;
reg STR_TAG ;
initial begin
STR_CNT = 0 ;
FILE_RD = $fopen ("src.txt","r");
FILE_WR = $fopen ("des.txt","w");
while( !$feof( FILE_RD ) ) begin
STR_TAG = $fgets ( CHAR, FILE_RD); //每次读一行文件
if ( CHAR == 10 )
$fdisplay(FILE_WR,"This is a TAB "); //Tab
else if (CHAR == 0 )
$fdisplay(FILE_WR," File is end "); //file finish
else begin
STR_CNT = STR_CNT + 1 ;