Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   How to clear a char variable (http://www.velocityreviews.com/forums/t744806-how-to-clear-a-char-variable.html)

Azteka77 03-08-2011 05:45 PM

How to clear a char variable
 
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


All times are GMT. The time now is 02:36 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.