# cof\_serXgetc returns before getting a char

**URL:** <https://forums.digi.com/t/cof-serxgetc-returns-before-getting-a-char/10090>\
**Category:** Rabbit\
**Created:** [May 16, 2008, 1:40pm UTC](https://forums.digi.com/t/cof-serxgetc-returns-before-getting-a-char/10090 "2008-05-16T13:40:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![User1109](https://avatars.discourse-cdn.com/v4/letter/u/91b2a8/32.png) [@User1109](https://forums.digi.com/u/User1109)\
**Post date:** [May 16, 2008, 1:40pm UTC](https://forums.digi.com/t/cof-serxgetc-returns-before-getting-a-char/10090/1 "2008-05-16T13:40:10Z")

</div>

Sample Cof\_EchoChr.C runs fine for me.  
However, if I create sub-cofunc, like

cofunc void echochar(void) {  
int c;  
wfd c = cof\_serDgetc();  
wfd cof\_serDputc(c);  
}

and substitute the original calls from the costate to the wfd echochar();

things stop work. In particular, the program starts outputting characters to the serial port without waiting for the input. debug shows that cof\_serDgetc() aborts without waiting for the input and returns -1;

why?
