LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Text file is keept in memory and not deleted

Solved!
Go to solution

I have written a small  program to eliminate whitespace, comments, and empty lines from gcode.

The resulting file will always carry the same name 'reduced.gcode' and resides in the path were the original file is located.
As the program could be executed several times during the time the main vi is active, I wanted to make sure, that old code is not simply overwritten because I fear that if the new gcode was shorter than the old one, parts of the old gcode would still be left in the text file.

To implement this I am deleting the file in the beginning.
But if I execute the vi twice in a row without closing the vi window the new gcode is merely appended to the text file. If I then close the vi and open it again and run the code for the first time a new instance of 'reduced.gcode' is saved containing only the wanted gcode.

I'm assuming I'm not handling a reference correctly.

textfile_problem.png

 

 

 

 

0 Kudos
Message 1 of 3
(2,280 Views)
Solution
Accepted by topic author schpongo

I just had a quick look but I would suspect the un-initialized shift register in your FOR loop. Initialize it with an empty string array.

 

Ben64

0 Kudos
Message 2 of 3
(2,269 Views)

You have an uninitialized shift register on your For Loop for the pink string wire.

 

Uninitialized shift registers maintain their data between calls.  Wire an empty string constant to the input shift register and it will clear it on every call.

0 Kudos
Message 3 of 3
(2,267 Views)