This is basically my attempt to write to a file in real time without hitting the enter key. However there is an error occuring. This is written in visual studio 2015.

The functionality of this program is that one can enter any keystroke and that keystroke will be sent to hello.txt updating it immediately. And when EOF is pressed, then the program ends.

In debug mode the error seems to to stop at fprintf(fp, (const char * const)ch); <--- I casted the int type ch to (const char * const)

Code:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <errno.h>
#include <conio.h>


int main()
{
	int ch = 0;
	FILE *fp;
	fp = fopen("hello.txt", "w");
	if (fp != NULL)
	{
		while (ch != '-1')
		{
			ch = _getch();
			fprintf(fp, (const char * const)ch);
		}
		fclose(fp);
	}
	else
	{
		printf("Error opening file\n");
	}
	return 0;
}