writing to a file

HOw do you open a file for read and write access? And can you write to the file while you read from it?
GoofyJoe99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

stedan_98Commented:
yes! here is the code:
(miss out the number and bracket if your copying and pasting into vb):

---------------------------------------
0) open "data.dat" for random as #1
---------------------------------------

functions:

---------------------------------------
1) get #1,indata
2) get #1,1,indata

3) put #1,outdata
4) put #1,1,outdata
---------------------------------------

ok now for an explanation:

0 = this function opens a file for both read and write access
1 = this gets all the data in the file and assigns is to the variable indata
2 = this gets the data at record number 1 in the file and stores it in the indata variable
(note: you must use the put statement example 4 to use records as you have to create them first or make sure they exist)
3 = writes to the file all the data in the outdata variable
4 = puts to record number 1 in the file all the data in the outdata variable

NOTE: the #1 stands for file number 1
when you say open ....... for random as #1 you could also say #2,#3 whatever

*hope this helps*
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GoofyJoe99Author Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.