The '\' character needs to be doubled. the backslash is used for special characters such as '\n' = newline or '\t' = tab, a plain backslash is represented as '\\'.
After writing to the file, use rewind() to reset the position to the start.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <stdio.h>
int main()
{
FILE *f;
char ch;
f=fopen("D:\\Hello.prat","w+");
ch=getchar();
putc(ch,f);
rewind(f); // reset position to start
ch=getc(f);
printf("%c",ch);
}