char *c;
c=(char *)chnlD;
c is a pointer. It doesn't point to anything. You can not put a value in the space it (doesn't) point to that way. You should not point to one type (int) with a pointer of another type (char), unless you really know what you are doing.