LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WRITE CHARACTERS TO FILE???

Hi everyone,

I am working on a VI that has to write some characters into an existing
file.
I have used: Open File--> Write to File--> Close File but once it
writes the desired data to that file it also writes some kind of bug
which cannot be read once that File is read.
Therefore I used the Wirte Characters to File SubVI which works ok.
When the new data comes in it has to replace the old one, this means
that the APPEND TO FILE option of the subVI is set to FALSE. The problem
is that everytime my VI runs and generates the new data that will
replace the old one, it asks me if I want to replace the existing file,
which is what I want to do.
My question is, if there is any way to override the prompt window that
asks if the e
xisting file will be replaced and perform the "replacement"
automatically?

Appreciate any help,


Horacio Castilleja
abuelazo@hotmail.com
0 Kudos
Message 1 of 4
(3,108 Views)
Horacio Castilleja wrote in message
news:3A6C8F89.3F110E9B@hotmail.com...
> Hi everyone,
>
> I am working on a VI that has to write some characters into an existing
> file.
> I have used: Open File--> Write to File--> Close File but once it
> writes the desired data to that file it also writes some kind of bug
> which cannot be read once that File is read.

Not sure what you mean by "some kind of bug". If you write binary data to
the file you won't be able to make sense of it later with a text editor, and
if you're simply wiring numerical data or a complex structure then the
function may be writing raw binary data. However, if you convert your data
to a string and wire that string to the function, it should work fine.

> My question is, i
f there is any way to override the prompt window that
> asks if the existing file will be replaced and perform the "replacement"
> automatically?

If you must go this way, simply delete the file before attempting the write.
If the file doesn't exist, the delete will fail but not generate a requestor
of its own. The delete function is in the "Advanced" sub-palette of the file
I/O functions. Or go into the "Write Characters to File" VI and modify it to
make your own file save function that doesn't pop up the requestor, but make
sure you save it with a different name to avoid it being overwritten during
an update.
0 Kudos
Message 2 of 4
(3,107 Views)
This is a common problem with using some of the simple VIs that do not
present all of the common/usefull functions.
If you "Save As..." the Write Characters to File.vi to another name like "My
Write Characters to File.vi" and add a boolean control
to the front panel or boolean constant to the diagram and connect it to the
"Advisory Dialog? (display:T)" boolean input of the Open/Create/Replace
File.vi, with a False, it will suppress the dialog box.
Stu

Horacio Castilleja wrote in message
news:3A6C8F89.3F110E9B@hotmail.com...
> Hi everyone,
>
> I am working on a VI that has to write some characters into an existing
> file.
> I have used: Open File--> Write to File--> Close File but once it
> writes the desired data to that file it also w
rites some kind of bug
> which cannot be read once that File is read.
> Therefore I used the Wirte Characters to File SubVI which works ok.
> When the new data comes in it has to replace the old one, this means
> that the APPEND TO FILE option of the subVI is set to FALSE. The problem
> is that everytime my VI runs and generates the new data that will
> replace the old one, it asks me if I want to replace the existing file,
> which is what I want to do.
> My question is, if there is any way to override the prompt window that
> asks if the existing file will be replaced and perform the "replacement"
> automatically?
>
> Appreciate any help,
>
>
> Horacio Castilleja
> abuelazo@hotmail.com
>
>
>
0 Kudos
Message 3 of 4
(3,107 Views)
My thanks to the above poster! I ran into the exact same issue and your fix worked perfectly.
 
Cheers!
0 Kudos
Message 4 of 4
(2,984 Views)