AboutAlex Barry Expertise I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, c/c++, python, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.
Experience Hobby programming since 2000
I no longer belong to any community programming groups, but do have knowledge of *basic dialect and C/C++
Expert: Alex Barry Date: 4/4/2008 Subject: Sequential file manpulation
Question I want to develope a small module , which can Add , modifiy , find and delete records in a small database.
<code> <description1> <description 2>
I want to use sequential file manipulation . Please could you help
Answer Hi, arpit,
I won't write a program for you, but I can give you some snippets of code and some hints on how to proceed.
First, you'll want to use TYPEs (UDTs) to store your data.
it should look something like this:
TYPE DB_Entry
code as string * 255
desc1 as string * 150
desc2 as string * 150
END TYPE
This will allow you to throw one variable into a file with all the information you need. To be able to put the information into and out of the file, you'll want to use BINARY files.
DIM size AS INTEGER
DIM file AS INTEGER
size = LEN( DB_Entry )
file = FREEFILE
OPEN "yourdatabase.ext" FOR BINARY AS #file LEN=size
REM - Do your database stuff here...
CLOSE #file
To put data into your file, and to take it out, you'll need to use GET and PUT
REM - The record% variable isn't required, but good if you don't want to get the variable in the last place the file pointer was.
That should be all you need to know for this sort of thing. If you have any specific problems, you can always post again and I'll clearify whatever you don't understand.