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
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