LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a problem with the append command in CVI 5.0?

I use the append command in a fmt statement and I use it again two lines later.
But from time to time when I run the program I see the first item appended to the end of the second.
I'll get 5015888_123456.dat_ I don't expect the second "_"
code
Fmt (Bin_file_name, "%s[a]<_");
Fmt (Bin_file_name, "%s<%s%s",Bin_file_name,SerialNo); Fmt (Bin_file_name, "%s[a]<.dat");
0 Kudos
Message 1 of 2
(2,833 Views)
I took a good look at this code, and you must have some type of loop running, because you should not see the second "_" at the end there. There is no place in the code that you submitted that would place something there. Something that I saw when testing this code is that after you append the file Bin_file_name, the appended file is now saved in Bin_file_name. So for example, you may have Bin_file_name as "hi". After the append, Bin_file_name is actually "hi_" Then after your next two lines, Bin_file_name would be "hi_friend.dat" Now if the loop goes through again without you resetting the value of Bin_file_name it will tack on the "_" at the end of "hi_friend.dat" to "hi_friend.dat_" If you want to reset the value of Bin_file_name, just use Fmt (Bin_file_
name, "%sI have attached code you can look at as well, and I spelled the file name as Fomat, which should be Format. Oh well. Thanks.
Download All
0 Kudos
Message 2 of 2
(2,833 Views)