i use the method "ReadString" to get a string from the user.the string contains numbers and',' to separate each of them. for example, 2,1,56,7,9. and i want to keep each number into a memory.

if the number is just one integer, its can be kept into the array easily but if the number contains 2 integers or more how can i do???

in my opinion,everytime the program meet the ',' ,the number will be copy to a memory(named val1) i.e. 2 is copied to val1[0] , 1 to val[1]  , 5 and 6 to val[2] and so on..

before i copy each number to the memory, i keep it in a temporary memory too. that is i keep 2 to tempVal[0] and then move it to val1 and insert a new number to the same position (i.e. tempVal[0]).so tempVal[0]=5 tempVal[1]=6 thats why i ask you how to combine numbers in the array together.

how can i do that thing?

if you don't understand what i'm telling ,ask me!!

thank you for your help.
Posted on 2006-09-16 11:03:16 by prite
This place (ASMCommunity) is mostly for Assembly Language related programming topics. Since you are asking a very VB/C++ (MFC) related question, I have doubts that anyone will answer to your liking.

I would recommend searching the CodeGuru Forums for the info you need. I made a quick search for "ReadString" and 243 results came up, sounds promising... good luck ;)
Posted on 2006-09-16 11:18:06 by SpooK
prite, the task is simple.
look for comma, put null byte instead comma, maintain start-end string, convert
string to int, store to array.

shifting array, practically speaking, does not make sense.
if you want reverse order, simply start at end.
look at the code how i defined max length (constant) and real length (nval)

note: CRT functions used

.model flat,C
option casemap:none
include libc.inc
sortproc proc p1:PTR,p2:PTR
mov eax,p1
mov edx,p2
mov ecx,
.if sdword ptr ecx<
return -1
.elseif sdword ptr ecx>
return 1
return 0
sortproc endp

main proc uses esi edi ebx argc:dword,argv:ptr dword
max_vals equ 10
LOCAL buff[200h]:byte
LOCAL vals:sdword
invoke puts,T('Enter comma delimited string:')
invoke gets,addr buff
invoke strlen,addr buff
mov ebx,eax
mov nval,0
lea esi,buff
lea edi,vals
.while sdword ptr ebx > 0
invoke strtok,esi,T(',')
.break .if eax == 0
invoke atoi,esi
inc nval
.break .if nval == max_vals
invoke strlen,esi
lea esi,
sub ebx,eax
dec ebx
invoke qsort,addr vals,nval,sizeof sdword,offset sortproc
xor ebx,ebx
.while ebx<nval
invoke printf,T('%i'),vals
inc ebx
.if ebx<nval
invoke printf,T(',')
invoke puts,T(CR,LF,'done.')
invoke getchar
return 0
main endp

Spook, pure asm here |  :D
Posted on 2006-09-16 22:07:16 by drizz

Spook, pure asm here |  :D

Great... but will he understand any of it???

Due to the context of his post, it just really seemed that he was aiming toward VB/C++. I may be wrong, but all the indications insist otherwise.

It would be great for him to learn how to do it in ASM, as it would definitely give him some insight in to what is actually being done... but I am not here to convert anyone... so I gave him the next best thing :)

Thanks for assisting anyhow, drizz, hopefully it helps him.
Posted on 2006-09-17 01:16:45 by SpooK
drizz, you gave me what i want. i forgot to tell you that i wrote in asm. how can you know ?
thanks very much.

it's work
Posted on 2006-09-18 10:21:11 by prite