added getc function