|
-
Mar 11th, 2000, 10:40 AM
#1
Thread Starter
New Member
Currently in my project, I am using Read and Write. This is far too slow when it comes to saving stuff cos i have to rewrite the file again and my file is huggee. my file looks kinda like this:
"part1", "secondbit", "thirdbit", etc
"walrus", "bigman", "mad"
will using the Put statement make it possible to change a line in my file without rewriting the file again?, and how would i read the line again?
i want all the data being read from the file to be stored into arrays i.e. FirstPart(1)="part1"
FirstPart(2)="walrus"
please help
-
Mar 11th, 2000, 01:59 PM
#2
Lively Member
is each line of your file related to each other in a way that would let you define a UDT?
-
Mar 11th, 2000, 08:39 PM
#3
Thread Starter
New Member
Sorry, whats a UDT? Im kinda new to visual basic
-
Mar 12th, 2000, 01:46 AM
#4
Addicted Member
-
Mar 12th, 2000, 04:26 AM
#5
Thread Starter
New Member
-
Mar 12th, 2000, 05:25 AM
#6
Lively Member
'define your UDT
type person
dim firstname as string * 10
dim lastname as string * 10
end type
'create and instance of your UDT (person)
dim p as person
'open a file in random
open "yourfile" for random as fp len = len(p)
'len = len(p) defines the length of each record in the file
'firstname and lastname use fixed length strings so each
'record you write is the same length, and then can write
'and retrive records in the middle of a file
get fp, 5 , p
'would read the 5th record of your file into the UDT var p
'leaving out the record number, i think, writes to the end
'file, but you might want to check on that
put fp, 5, p
'would write your UDT var p to the 5th record in your file
'then if you need to put it into a array
'but trim off the spaces (fixed len strings)
array(0) = trim$(p.firstname)
array(1) = trim$(p.lastname)
any help???
-
Mar 13th, 2000, 04:35 AM
#7
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|