Read only first word of line from line with $fscanf()

In reply to Vaino:

Then what you want is something like:


      string line;
      string first_word_column [];
      fd = $fopen ("myfile.txt", "r");
      while (!$feof(fd)) begin
          code = $fgets (line, fd); //Get entire line
          code = $sscanf (line, "%s", first_word_column[i]); //Get first word of that line
          i++;
      end
      $fclose (fd);