How to clear a char variable

Joined
Mar 8, 2011
Messages
1
Reaction score
0
Hi,

Do you know how can I clear a Char Variable?
I'm using label var to receive a SerNum from a Barcode reader, then I use strcat to apend this value to another var that later I use to log the result for a Test as follows.

char barcode[15];
char label[15];
char ImageBarcode[23] = {"ImageBarcode:"};
.
....
read_barcode2(bar_label_path, 11);
strcpy(label,barcode);
strcat(ImageBarcode,barcode);

Then using fopen, I create a TXT file with some data, using fputs.
at first run all is Ok but at 2nd time, the line for imagebarcode showed something like this::sheep

ImageBarcode:C123S025 (1st time)

ImageBarcode:C123S025C123R137 (2nd time)

I tried to clear my var using this
ImageBarcode = "";
ImageBarcode[23] = "";
ImageBarcode = "\0";

And nothing :bawling:, I got an error like invalid conversion char * to const char *.

Any Idea?

TIA
KR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top