title: How can I $fwrite a negative integer number in a file?
body: <p>I have an ALU in Verilog, and I want to write the ALU's output into a file.  I am using the following code:</p>
  
  <pre><code>$fwrite(File,"La salida es: %d",uut.ALUOutput);
  </code></pre>
  
  <p>My output vector has a size of 32 bits (signed). The operation is correct, but when <code>ALUOutput</code> is a negative number, in the file, the output is saved like integer unsigned.  </p>
  
  <p>For example, in the file for a negative number, I obtained the following incorrect representation:</p>
  
  <pre><code>4294967264
  </code></pre>
  
  <p>But, I want to obtain the following result:</p>
  
  <pre><code>-32
  </code></pre>
  
  <p>How can I write a negative number in a file?</p>