title: Replacing a character in a string in assembly MASM
body: <p><strong>What have I done before</strong></p>
  
  <p>I was trying to simply replace or overwrite a character in a particular location in a string. I wrote this code:</p>
  
  <pre><code>INCLUDE Irvine32.inc
  .data
  myMessage BYTE 'This is a string',0
  
  
  .code
  main PROC
  call Clrscr  
  mov esi, OFFSET myMessage
  inc esi
  inc esi
  inc esi
  mov ebx, 'a'
  mov [esi], ebx
  mov  edx, OFFSET myMessage
  call WriteString
  call crlf
  
  exit
  main ENDP
  
  END main
  </code></pre>
  
  <p><strong>The problem</strong></p>
  
  <p>The expected output of this program is "Thia is a string"
  but it outputs "Thia".
  Now wherever I overwrite a character in a particular location in this string, when I print it using a call to WriteString, the printing of that string stops at the location wherever the byte is replaced.
  How can this be solved?</p>