Hello all!
i was having some trouble with declaring a string and its size :(, and i was hoping that someone could help me :)
i tried writing a macro /w my almost non-existent macro-writing skills (i know, shameful) to do this, but the characters like nulls messed it up (it took them as a parameter)
anyway, my problem is basically to create an error message by defining it once and outputting it to a winsocket. the "send" function requires the size of the data as one of its operands, but since my error messages are constant, there is no need (and indeed, it is a waste) to dynamically find the size of the error message. without defining the entire text of a message twice in a CONST and in the data section, i am trying to have one variable storing the message and another storing the length.
in otherwords, something like this:
any help would be appreciated! :)
i was having some trouble with declaring a string and its size :(, and i was hoping that someone could help me :)
i tried writing a macro /w my almost non-existent macro-writing skills (i know, shameful) to do this, but the characters like nulls messed it up (it took them as a parameter)
anyway, my problem is basically to create an error message by defining it once and outputting it to a winsocket. the "send" function requires the size of the data as one of its operands, but since my error messages are constant, there is no need (and indeed, it is a waste) to dynamically find the size of the error message. without defining the entire text of a message twice in a CONST and in the data section, i am trying to have one variable storing the message and another storing the length.
in otherwords, something like this:
.data
Error404 db "File Not Found"
.const
Error404Size textequ @SizeStr(Error404)
any help would be appreciated! :)
.data
Error404 db "File Not Found", 0
.const
Error404Size EQU SIZEOF Error404
This will give you 15 including the NULL terminator. I think SizeStr only works only on a string inside it's bracketError404Size EQU @SizeStr(<Hello>)
This one will give you 5.For this I would do
invoke send, Sock, addr Error404, (LENGTHOF Error404-1), 0
I don't think the brackets are realy necesary though
invoke send, Sock, addr Error404, (LENGTHOF Error404-1), 0
I don't think the brackets are realy necesary though
ErrorString MACRO _name:REQ,y:VARARG
CONST segment
_name db y,0
_name&_Length EQU SIZEOF _name
CONST ends
ENDM
ErrorString Error404, < \
"Very bad thing has happened.",10,13, \
"You get no pudding!">
thanks, all!
i've got me some puddin', though, bitRAKE :)
i've got me some puddin', though, bitRAKE :)