Sign in to follow this  
Followers 0
AlanB22

Problem with _Tempfile

5 posts in this topic

I am not sure if it is a bug or my interpretation of the help?

I have tried the following:

$fn = _tempfile(@scriptdir & "dir1dir2","AB_",".txt")

OR

$tpath = @scriptdir & "dir1dir2"

$fn = _tempfile($tpath,"AB_",".txt")

In both cases the result for $fn is that it substitutes the directory path held in %Temp%

By using an expilcit path it works.

$fn = _tempfile("C:dirAdirBdir1dir2","AB_",".txt")

Is this as designed, as I expected all to be evaluated correctly and that the temp path would be defaulted to when "" a blank parameter was enetered.

Alan

 

Share this post


Link to post
Share on other sites



Checking the _Tempfile() function seems that if the path doesn't exist then the default is @Tempdir, this is the line in function _Tempfile():

If $sDirectoryName = Default Or (Not FileExists($sDirectoryName)) Then $sDirectoryName = @TempDir

Share this post


Link to post
Share on other sites

Hi Guys

Thanks, for clarifying the operation of this function.  I was using the tempfile() function to create a random unique filename which I was subsequently opening using fileopen($fn,10) to create the path and open the file if it did not exists.

I have used the _tempfile function previously without a problem.

All has become clear.

Cheers

Alan

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0