Jump to content

"Imaginary file"


andries
 Share

This topic is 4317 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am playing around with the File class, and I am trying to create files immediately in a container, without being created on the hard disk (just as an experiment, don't have a real goal yet:) )

I wrote the following lines of code:

def myFile = new File ( "test.txt" );

myFile << "First Line Of text";

return myFile;




When I run this 2 times the result is a text file in my container containing two times the line "First Line Of Text". When a run it three times it contains it three etc etc. (I guess you all get the picture)



I know that the command "<<" will append the text if the file already exists, so this means to me that somewhere in the memory the variable "myFile" is still alive...



So I created the following lines of code:




def myFile = new File ( "test.txt" );

myFile << "First Line Of text";

def myResult = myFile;

myFile = null;

return myResult;

But I have the same result. I restarted FileMaker, used the SMReset function, but it is always the same behavior.

What is going on in this piece of code?

Link to comment
Share on other sites

This topic is 4317 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.