8 Replies - 4568 Views - Last Post: 10 July 2012 - 01:12 PM

#1 Latias  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 28-June 12

Get every char in a string

Posted 08 July 2012 - 03:04 PM

yo peepz

as the title says i need help with coding (masm) a procedure that takes every char in the enterd string.
the return value should be the grabbed char.

a friend gave me the name of the function which can do that, but i can't find any lib or inc file for masm about this function: MFC71U

he told me this function is looking like this, its only not working properly

MOV EDX,byte PTR SS:[Buffer+4]
MOV EAX,DWORD PTR DS:[buffer]
MOV AX,WORD PTR DS:[EAX+EDX*2]    ; edx = loopcounter
RETN




is there any working example available?

Is This A Good Question/Topic? 0
  • +

Replies To: Get every char in a string

#2 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,281
  • Joined: 28-March 11

Re: Get every char in a string

Posted 08 July 2012 - 03:18 PM

Never heard of a function called MFC71U. I have however heard of MFC71U.dll which is the Microsoft MFC Support Library. Never heard of anyone using it in Assembly though.

May I ask, why DOS code? Your much better off with 32bit code. MASM32 has a few functions and macros to work with the console.

This librarycontains 16 and 32 bit code

Buy his book, it will do you well.
Was This Post Helpful? 0
  • +
  • -

#3 Latias  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 28-June 12

Re: Get every char in a string

Posted 08 July 2012 - 03:44 PM

actually MFC71U is not for assembly i guess, i think for c
but i cant see, and im learning asm

why dos code? actually i didnt know that i wrote doscode. im just writing in a editor with a masm compiler, and im using macros too :)
Was This Post Helpful? 0
  • +
  • -

#4 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,281
  • Joined: 28-March 11

Re: Get every char in a string

Posted 08 July 2012 - 05:51 PM

Where is this entered string coming from? Is it from an Edit control, a file, the console, a package from the mailman?

This makes no sense:

Quote

procedure that takes every char in the enterd string.
the return value should be the grabbed char.

Explain this a bit more clearly. Do you want the length of the entered string? What is a grabbed char if the user entered a string?
Was This Post Helpful? 0
  • +
  • -

#5 Latias  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 28-June 12

Re: Get every char in a string

Posted 09 July 2012 - 02:31 AM

the string is comming from a editbox


Quote

Do you want the length of the entered string


no, just all the chars, let me explain


user enter a string like ; hello

then i want to grab the 'h' from the string, then i coded already a check if this char is a legit char, if not then error if it is then continu with the next char the 'e'. also if the second char is valid then go to the 3'th char 'l', etc.

so the first return value of the loop should be the 'h' in eax, when looping for the second time the return value should be 'e' in eax.

And i dont know how to code such loop
Was This Post Helpful? 0
  • +
  • -

#6 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,281
  • Joined: 28-March 11

Re: Get every char in a string

Posted 09 July 2012 - 03:28 PM

Why not just validate the characters as they are entered/pressed? I would subclass the edit control and use a lookup table that contains valid characters. If a keypress is a valid character, allow the keypress to go through, if not, discard it. Handle the WM_CHAR message and the character code will be in wParam, use the character code as the index into your lookup table.

I wrote a tutorial on subclassing and filtering input here
Was This Post Helpful? 0
  • +
  • -

#7 Latias  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 28-June 12

Re: Get every char in a string

Posted 09 July 2012 - 03:51 PM

actually this function should be test if the customer used a valid email

i mean not just test the editbox on a '@' to confirm its a valid email or not, but the entered email should be also in the right email-format
a sorth of regex.
Was This Post Helpful? 0
  • +
  • -

#8 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,281
  • Joined: 28-March 11

Re: Get every char in a string

Posted 09 July 2012 - 04:04 PM

What is a valid email? A string with the @ symbol? These are valid email addresses:
!def!xyz%abc@example.com
Abc@def"@example.com
_somename@example.com

Have you read the SMTP RFCs? I think that would be the first thing you do.
Application Techniques for Checking and Transformation of Names
Simple Mail Transfer Protocol
Internet Message Format

Once you understand the format of Email Addresses THEN you can write a parser. Just loop through the string and make sure it does not contain invalid characters. Then check for proper format.

NOT a simple task for a beginner.
Was This Post Helpful? 0
  • +
  • -

#9 Latias  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 28-June 12

Re: Get every char in a string

Posted 10 July 2012 - 01:12 PM

Quote

What is a valid email? A string with the @ symbol?


Quote

i mean not just test the editbox on a '@' to confirm its a valid email or not


thank u i shall read more about it
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1