We help IT Professionals succeed at work.
Get Started

WRITE STRING TO TEXT FILE AND CLEAR MEMORY

Latzi_Marian
Latzi_Marian asked
on
604 Views
Last Modified: 2013-12-26
Hi Gents,

I've got the following routine in VB6:

Private Sub wsock_DataArrival(ByVal bytesTotal As Long)
Dim sItemData As String
               Dim sNewFile As String
               Dim lFreeFile As Long

wsock.GetData sItemData, vbString
Debug.Print sItemData
               sNewFile = App.Path & "winsock.txt"
               lFreeFile = FreeFile
               Open sNewFile For Output As lFreeFile
               Print #lFreeFile, sItemData
               Close lFreeFile
End Sub

On the immediate window the result of "Debug.Print sItemData" is showing up exactly as I want .However If I stop the code then restart itemswhich were collected through winsock the previuos seesion are still on the immediate window.
What I'd like to do is to write the data sItemData into a flat file clear the memory and every time the flatfile gows to let's say 100kb start a new file andrename the old.
The way I tried towrite the values from the immediate window to the f\winsock.txt file doesn't work at all.I have no ideea why.Could you please help me understand how to clear the data from the immediate window and copy it into winsock.txt then delete it.
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE