Address Book Program

  • Follow


Hello All,
I am really in need of some help. I am trying to create an "address
book" application using 80x86 assembly language. I can get to read
from a text file, and write to it, but I have no idea how to go about
finding a "record" in the file, or how to go about deleting a "record"
from the file. Each "record" is on a new line in the file, an d
stores:

first name, last name, age, id number.

Thanks and regards,
Ryan.

0
Reply spamtrap2 (1628) 5/5/2007 10:59:50 PM

r.dossantos schrieb:

> Hello All,
> I am really in need of some help. I am trying to create an "address
> book" application using 80x86 assembly language. I can get to read
> from a text file, and write to it, but I have no idea how to go about
> finding a "record" in the file, or how to go about deleting a "record"
> from the file. Each "record" is on a new line in the file, an d
> stores:
> 
> first name, last name, age, id number.

Does the records placed in defined size?

Else mayby a carriage return(0Dh) or a linfeed(0Ah) can help to find the
end of a line. Then you can copy the rest of the file, to the begin of
the line that you want to delete.

Dirk

0
Reply Dirk 5/6/2007 6:36:49 AM


On 5 May 2007 15:59:50 -0700, r.dossantos <spamtrap@crayne.org> wrote:

>Hello All,
>I am really in need of some help. I am trying to create an "address
>book" application using 80x86 assembly language. I can get to read
>from a text file, and write to it, but I have no idea how to go about
>finding a "record" in the file, or how to go about deleting a "record"
>from the file. Each "record" is on a new line in the file, an d
>stores:
>
>first name, last name, age, id number.
>
>Thanks and regards,
>Ryan.
>

Sounds like you will need to find more than just each record
(which as DIrk suggests you can do with carriage return and line
feed); you will also need to be able to find each field in a record.
For a simple database like this, you would probably be best
off to use defined-size fields.  You will need to decide how much
space to allocate to each field.  Some can be very short, such
as age (one byte).  ID number is probably already a defined
size.  But for names you have to pick a balance between being
able to handle very long names, versus wasting lots of space
for all the shorter names.  And you will need to have a mechanism
on the input side to restrict entry to field size.

Once you have done that, the answer to your question should
be obvious:  One record size is the sum of all fields in that record.
To find any record by number, multiply the record number by the record
size. To find based upon contents of a certain field (last name, say)
you search by starting at the beginning of the chosen field in the
first record,  and if that's not a match you just add the record size
to the filed start to get to the start of the same field in the next
record.

Deleting a record will involve moving all other records up to fill
the gap. (Hint:  Spend some time drawing little diagrams about
how the move should proceed, so that you don't overwrite
the data you want to move next.)

No need for carriage returns and line feeds to be stored; just
add them for display.

Best regards,


Bob Masta
 
            D A Q A R T A
Data AcQuisition And Real-Time Analysis
           www.daqarta.com
Scope, Spectrum, Spectrogram, Signal Generator
    Science with your sound card!

0
Reply NoSpam 5/6/2007 12:03:06 PM

On May 5, 5:59 pm, r.dossantos <spamt...@crayne.org> wrote:
> Hello All,
> I am really in need of some help. I am trying to create an "address
> book" application using 80x86 assembly language. I can get to read
> from a text file, and write to it, but I have no idea how to go about
> finding a "record" in the file, or how to go about deleting a "record"
> from the file. Each "record" is on a new line in the file, an d
> stores:
>
> first name, last name, age, id number.
>
> Thanks and regards,
> Ryan.
Since any good text editor can do what you are trying to do in
assembler, I assume that you are doing this for the sake of the
exercise. If so, you can, of course, follow the preceding advice and
restrict yourself to fixed length fields. A more challenging exercise
is to allow variable length fields together with an index, either in
the same file or in a separate file, the latter being easier to
develop and maintain. The fields in the index file are of fixed
length, each containing a pointer to the respective record and the
length of the record in your data file, as well as respective pointers
and lengths for of each field in the record. Field pointers may be
relative to the beginning of the record.

Details are up to you to plan. They depend on the operating system
under which you develop your program.




0
Reply lavron 5/6/2007 8:19:41 PM

3 Replies
116 Views

(page loaded in 0.063 seconds)

Similiar Articles:













7/24/2012 3:10:06 PM


Reply: