News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Strcat a carriage return and line feed problem

Started by travism, May 11, 2009, 01:36:57 AM

Previous topic - Next topic

travism

Hey everyone, Im having 2 issues ive been trying to work on I know its simple, but for some reason I cant figure it out Im using GetDlgItemText to grab the text from a edit box and I need to append a carriage return line feed on it so when i write that text to a new file it adds a new line. The code I have that doesn't work is


.const
; They might be backwards
CR  equ 10
LF   equ  13

.....

invoke lstrcat, myBuff,CR


as you can see you can see what im trying to do, but it doesnt work.. and then also im just trying to add some spaces to the end of a buffer but that doesnt work either? Any help would be appreciated. Thanks ahead of time! :)

redskull

I'm pretty sure they both have to be pointers;  it would have to be:

.data
CR db 10
LF db 13

<etc>

invoke lstrcat, ADDR mystring1, ADDR CR
Strange women, lying in ponds, distributing swords, is no basis for a system of government

travism

Oh my bad, I just wrote that quickly from memory. In my code I do have the pointers, and still a no go :\

redskull

They probably need to be null terminated as well, and make sure string 1 is big enough to hold the extra characters.  But again, all this is half from memory, half from gut feeling.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

travism

Wow, Im so retarded I made it way more complicated than it was.. All i had to do was:


CRLF  db 13,10,0

....

invoke strcat, addr myBuff, addr CRLF


Thanks for the help :)