Fscanf Return Value

initial begin
bit [127:0] cmd;
int file, c;

file = $fopen ("commands.txt", "r");
while (!$feof(file)) begin
	c = $fscanf (file, "%s", cmd);
$fclose (file);


What will the value of c be in every iteration of the while loop?

The answer to your question is in the last paragraph of section Reading formatted data of the 1800-2012 LRM.

If you are having some confusion about what you are seeing, perhaps in the last iteration of the loop, why don’t you explain what you are seeing verses what you expected to see.