title: Reading from a txt file in assembly MASM?
body: <p>In the code below, <code>buffer</code> is my buffer read, <code>fileName</code> is the name of the file, <code>bytesRead</code> is supposed to be the returned string.</p>
  
  <p>I try to read from it, but it tells me that the buffer size is 6.</p>
  
  <pre><code>INCLUDE Irvine32.inc
  INCLUDE macros.inc
  
  .data
  MAX = 5000
  fileName BYTE 80 DUP (?)
  fileHandle HANDLE ?
  bytesRead DWORD ?
  buffer BYTE MAX DUP(?)
  
  .code
  main PROC
  
  mov  EDX,OFFSET fileName
  call ReadString
  
  mov  EDX,OFFSET fileName
  call OpenInputFile
  mov  fileHandle, EAX
  
  mov  eax,fileHandle
  mov  ecx,MAX
  call ReadFromFile
  mov  bytesRead,eax
  mov  edx, offset bytesRead
  call WriteString
  call crlf
  call WriteDec
  call crlf
  
  exit
  main ENDP
  END main
  </code></pre>