Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Integers from a file and dividing them

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi i am only new to assebly,
Could someone help me, i need to read 10 integers from a text file and get a total and divide them. I can open the file and read in a string, i cannot read in numbers seperatly for calculation/division. can you please help.

 
Read them in as strings. Then, convert them to integers. You're going to have to write your own atoi() routine here, though. Here is one algorithm for an atoi() routine in pseudo-code:

acc=0
loop:
get character
check if non-digit
if non-digit, jump exitloop
acc=acc*10
and character,0fh
acc=acc+character
jmp loop
exitloop:

It's your responsibility, of course, to write this into assembly code. "Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top