News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

possessive case in a line of text

Started by shankle, July 26, 2013, 06:55:07 AM

Previous topic - Next topic

shankle

In a line of text a word such as "inversion''s" causes the 1st letter of the line of text
not to print. Ex: derived shows as erived. Where in the documentation is this explained?
I only count the 2 ticks as one. If I increase it by 1 that does not solve the problem.

Yuri

I was unable to reproduce this. Can you provide any code that shows the bug?

shankle

Thanks Yuri for responding.
Hope this helps to solve the problem.

Text line as coded.
T10    db   'derived. The 2nd INVERSION''S 1st note is G (5th note of the C scale). The 2nd  ',0

Code to execute the above line.
    invoke TextOut, [hdc],10,215,addr T10,79       

This is what displays on the screen.   
    erived. The 2nd INVERSION''S 1st note is G (5th note of the C scale). The 2nd

Yuri

Yes, now I can see the effect. As it follows from the examples in the manual, you can use single quotes within a string only if the string is in double quotes, and vice versa. Or you have to use character codes instead of literal quote characters. The character code for the single quote is 27h.

T10    db   'derived. The 2nd INVERSION',27h,'S 1st note is G (5th note of the C scale). The 2nd  ',0

shankle

Thank you Yuri.
That fixed it.
I guess the answer is in the GoAsm docs but where?

Yuri

Basic GoAsm elements -> Data declaration -> Declaring strings + Declaring more than one string per line

wjr

At first glance, that looked like a double quote in the middle, in which case it should have worked (although you wanted the double and single quotes swapped). What you had was two single quotes there, and for that GoAsm probably should have given an error message instead of an error.

Your problem has been solved, but I shall still add this to the list of things to look into when I get a chance...

shankle

This is another example that I am having trouble with in GoAsm.
No error is given but the program stalls.
Neither datestring works.

datein             db   12 DUP (0)
datestring       db   "MM'-'dd'-'yyyy",0
datestring       db   "MM-dd-yyyy",0

    invoke GetDateFormat, NULL, 0, NULL, addr datestring, addr datein,12

Suggestions for where to read about it would be most appreciated.

wjr

The second datestring looks like the one that you want to use, and what you have shown should work. If it doesn't then the problem is elsewhere. One possibility, it looks like you are intending to use an ANSI string, so if you have defined the symbol UNICODE and/or used STRINGS UNICODE, that will throw things off (if so for both, use DUS instead of db for the strings so that they are UNICODE).

dedndave

give this a try, Jack

;###############################################################################################

        .XCREF
        .NoList
        INCLUDE    \Masm32\Include\Masm32rt.inc
        .List

;###############################################################################################

        .DATA

szTitle     db         'GetDateFormat',0
szFormat    db         'MM-dd-yyyy',0

;***********************************************************************************************

        .DATA?

stLocalTime SYSTEMTIME <>
szBuffer    db         12 dup(?)

;###############################################################################################

        .CODE

;***********************************************************************************************

_main   PROC

        INVOKE  GetLocalTime,offset stLocalTime
        INVOKE  GetDateFormat,LOCALE_USER_DEFAULT,NULL,offset stLocalTime,
                offset szFormat,offset szBuffer,sizeof szBuffer
        INVOKE  MessageBox,NULL,offset szBuffer,offset szTitle,MB_OK
        INVOKE  ExitProcess,0

_main   ENDP

;###############################################################################################

        END     _main


it's MASM syntax, but you can convert it   :P

shankle

#10
Thanks guys for responding.
I commented out the "GetDataFormat" and the program worked fine.
So neither string I used worked.
I am not doing anything with Unicode.
Could it be a header problem with GoAsm??
I use this same code in Masm32 and it works there.
I read in the manual about strings and could find nothing that applies to my problem.
I have two other programs with the same problem  - "GetDateFormat"

wjr

The above, although just a small snippet, tested fine at this end with Donkey's headers. If the return value from GetDateFormat is non-zero and the string in datein is what you expected, then the problem is elsewhere in what you do with this date string...

shankle

I am running Windows 7. Microsoft says I should use GetDateFormatEx with that OS.
What is the header name that contains this API? I want to check to see if it is included in my
GoAsm headers.


Yuri

You don't need any special header. On my Windows 7, both GetDateFormat and GetDateFormatEx work as expected. Only windows.h is included.

shankle

Hi Yuri,
Would you kindly give an example as mine still does not work?