Jump to content

Delete File


MikaelH

Recommended Posts

Hi

We have experienced some strange things on some computers running the a LV executable applications.

We download ini-file content from a database and temporary write them to an ini-file so we can use the Configuration File VIs.

1) We delete the file (it might already exist)

2) We write a new file

3) We open it with the “Open Config Data” VI.

So easy, but we have experienced problems on some computers running this code in an LV executable. It always works when running it from the Dev Environment.

(FYI the VI that create this Config data Refnum is not reentrant)

The problem is that the file is empty.

Why I see an empty file is probably because I use the Default input to the “Open Config Data” VI, that lets it Create the file if it doesn’t exist.

But why is it not created.

Any ideas?

Is Window treating files in the Temporary folder different?

Are commands (e.g. the Delete File), somehow cashed in Windows and executed later when the file is in the temporary folder?

We have solved it by doing this for now, but why why why????

post-941-126282006347_thumb.png

Cheers and happy New Year guys.

Mikael

Link to comment

Is Window treating files in the Temporary folder different?

Are commands (e.g. the Delete File), somehow cashed in Windows and executed later when the file is in the temporary folder?

Hi Mikael:

Even though your non-working code is probably trivial, maybe you should post a snapshot of that too. We do the same operation and haven't seen a problem in built exes. You mentioned it only happens on some computers. Is there a difference between XP and Vista/Win7?

Link to comment

Hi

We're running XP, and most of them are XP embedded.

We started to notice this problem when we updated the code to be LV 2009 compatible.

The funtion takes a string in and returns a Configuration Ref Num, in LV 2009, this is replaced by a class.

So in the initial design we used the "Private" functions in the Config VIs to create the object, but in LV 2009 this is not possible since we can use the private VIs any more.

This is the initial code, which always has been working:

post-941-126282781379_thumb.png

And here is the code we changed to and started generating problems.

post-941-126282795269_thumb.png

LcString_OpenConfigDataUsingString.vi

This problem has become more and more frequent for some reason, before is occurred about 0-2 times a week, but latelty we saw it several times a day.

Maybe it's the virus protection application that causes the problem.

Cheers,

Mikael

Link to comment

And here is the code we changed to and started generating problems.

post-941-126282795269_thumb.png

I'm not so sure what you're trying to do here - you delete the file if it's there (have you though of using the OpenG "File Exists?" before trying to delete it?), then you write some text into the file, then you try to open it using the Config Open. Yeah, I'd say there's a fludhing issue. Also, unless the initial text is formatted correctly, it's not going to be interpreted properly by subsequent Config File Reads...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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