File I/0 Functions
Ionut S.
BACAU,

Nov 10, 2015
1 Post

File I/0 Functions

Hello!
I created a file in "c:\\x.txt" and after with a form I created 2 buttons ( write and read) to write and read from that file and 1 textbox!
I want to know how can I write in textbox many times and when I'll read from the file (pressing Read button), to be capable to find all my TEXT that I saved before!
I tried with FileSeek and FileEOF, but still not working!
Thank you!

Have a nice day!

Solution Available
Orr K.
Irvine, CA

Nov 10, 2015
21 Posts

Re: File I/0 Functions

Hi.

First of all you need to make sure you have Read and Write access to the file. In this case I am creating the file from scratch every time.

lFileMode=aFileModeCreateNew or aFileModeRead or aFileModeWrite
textFile=FileOpen(GetDir(aGetDirCurrent)+"\\FileRead_"+str(Tick())+".txt",lFileMode)

Second, when reading from the file you need to select the beginning location of the file if you want to read all the files contents.

FileSeek(textFile,0,aFileOriginBegin)
lBytes=FileRead(textFile,sText)
tbTextFileView.Text=sText

I attached an example.

Regards,
Orr


File Attachment:
IOForums.zip



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]