Can someone help me? 
Author Message
 Can someone help me?

ok say i have a file called data.dat with records in it like
"aaron","dog"
"cat","hamster"
"rat","mose"
and i have a program that writes it to data.dat like that
is there any way to add an option to the program that lets
you search for and then change only that 1 item. ex. I want to search
for
rat because the second entry in that group is misspelled and i want to
change mose to mouse. Can anyone help
I don't know how to use get, put, or binary
 It's the last thing
that is keeping me from being done with my first
big program.
any help would be greatly appreciated!

thanks



Thu, 08 Jul 1999 03:00:00 GMT  
 Can someone help me?

Quote:

>ok say i have a file called data.dat with records in it like
>"aaron","dog"
>"cat","hamster"
>"rat","mose"
>and i have a program that writes it to data.dat like that
>is there any way to add an option to the program that lets
>you search for and then change only that 1 item. ex. I want to search
>for
>rat because the second entry in that group is misspelled and i want to
>change mose to mouse. Can anyone help
>I don't know how to use get, put, or binary
> It's the last thing
>that is keeping me from being done with my first
>big program.
>any help would be greatly appreciated!

Hi Tiki,

  I can only assume that the data file holding the animal names was opened in
SEQuential mode. This file mode is good for holding data that will, eventually
be loaded into memory in total. If you wish to make the data into something
that can be added to, deleted from and/or changed then you should have a look
at RELative file mode.

  RELative files are broken into RECORDs of equal length and each record, if
required, can be broken down into FIELDs. As each record is of equal length
one can easily import the data from one record into memory, modify it, the
replace it in the file with no damage to any of the other records. It really
is the easiest method of handling data that has been stored on the disk.

  Let's say that the longest animal name you'll be using is 16bytes/letters
long. The code below is over-simplified but will give you an idea of how
RELative files are used. Have a look into the HELP section of your BASIC; pay
attention to OPEN, GET$, PUT$, FIELD and maybe even TYPE (later).

OPEN "R", #1, "ANIMALS.DAT", 16
  LastAnimal% = LOF(1) \ 16

DIM Animal AS STRING * 16

FOR RecNo% = 1 TO LastAnimal%
  GET$ #1, RecNo%, Animal
  PRINT Animal
NEXT

  ____    _    ____      ____  _____
 |  _ \  / \  / ___) __ | ___)(_   _) |  Don Schullian
 | |_)  / _ \ \____\/  \|  _)   | |   |    Gramou 33
 |____//_/ \_\(____/\__/|_|     |_|   |  Papagou, 15669
 ___________________________________  |      Greece
  =================================== |  ++30-1-654-6200

   -----------======### DOWNLOAD ###=========------------
            Nutz 'n Boltz for powerbasic v3.2  
              A library of everyday goodies
   DOWNLOAD N-B-V2??.ZIP FROM YOUR FAVORITE SITE TODAY!



Fri, 09 Jul 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How do I create a canned form?

2. Canned AcctReceivable Module needed!

3. Canned pages....

4. Cans access2.0 engine access btrieve files?

5. Crystal Reports Canned Code

6. Canned objects and/or images

7. Switching from inhouse software to canned package.

8. line graph in vb (canned routine)

9. 'Canned' data in VB program

10. Looking 4 Canned Control

11. Need some help with some Access coding if someone could please help =)

12. NEED HELP WITH VISUAL BASIC 4.0 32-BIT SOMEONE HELP

 

 
Powered by phpBB® Forum Software