'How to create a text file that uses user input from Irvine library to write onto it

How do I create a text file that updates values inputted to by the user using Irvine's library?

for example for my data I have:

.data

frstValue BYTE "Enter first value", 0dh, 0ah, 0
scndValue BYTE "Enter second value', 0dh, 0ah, 0
seperator BYTE "," , 0
buffer DWORD 500 dup(?)    
filename BYTE "valuesEntered.txt",
fileHandle HANDLE ?

for my code, I'd have something along the lines of

mov edx, OFFSET frstValue
call WriteString
mov edx, OFFSET buffer
mov ecx, SIZEOF buffer
call ReadString

mov edx, OFFSET scndVal
call WriteString
mov edx, OFFSET buffer
mov ecx, SIZEOF buffer
call ReadString

mov edx, OFFSET filename
call CreateOutputFile
inc eax
mov fileHandle, eax

mov eax, fileHandle             
mov edx, OFFSET buffer
mov ecx, LENGTHOF buffer
call WriteToFile

I'm pretty much stuck here.

When I enter my values the edx reg overwrites the second user input with the one that was first written. What I'm trying to do is add the second user input at the end of the first. So it kind of look like this:

input 1: 20 input 2: 30

result: 20,30

instead, I just get 30



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source