Friday 15 June 2012

assembly - Nasm: Convert integer to string using preprocessor -


How does a name change an integer in a string using a preprocessor? For example, consider the following code:

  Define myInt 65% defines myString as 'sixty-five is', myInt   

The evaluation of the symbol myString will be sixty-five is A . The desired result is sixty five is 65 how can it be obtained? It seems that there is such a trivial question, but there is no such document. Thanks!

define this code

 % myInt "String (Myint) bits 32 dB mestring   

Define the string (x) quoted% + x% +% / P>

  1% myInt 65 2% Define "3% defined stringify (x) quot% + x% + 4% strcat myString is sixty-five ', stringify (myInt) 5 6 bits 32 7 00000000 536 9 7874792 D666976-DB MyString 8 00000009 65206973203635 and below Binary:  
  0000000000: 53 69 78 74 79 2D 66 69 a ?? ?? 76 65 20 69 73 20 36 35 Sixty-five is 65   

I used the compiled NASM version 2.10 on March 12, 2012.

No comments:

Post a Comment