Q:

C program freeze at fprintf ( large amounts of data )

I am attempting to write the clipboard contents to a file, but for some reason the program is freezing.
FILE *fp;
fp = fopen("tmp.code","w");
fprintf(fp,getclip()); /*writes*/

fclose(fp);

char* getclip(){

    HANDLE clip;
    if (OpenClipboard(NULL)){
        clip = GetClipboardData(CF_TEXT);
        CloseClipboard();
        return clip;
    }

}

What am I doing wrong ?
Thanks

A:

The function getclip() returns an int, and fprintf expects pointer to char. It is trying to access an invalid memory position: you're returning a HANDLE as int and then fprintf interprets that as a memory address to read characters from. 
Please look at your compiler errors and warnings and fix your code.

