Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   Debug assertion failed! error (http://www.go4expert.com/forums/debug-assertion-failed-error-t27197/)

keerth516 22Nov2011 16:22

Debug assertion failed! error

how to solve this error.I am trying to read each character from a file and want to display it on console window.But could display the result in visual studio 2008(VC++).I am getting the debug assertion failed !!.could you please let me know where i went wrong.
here is my code :

#include "stdafx.h"
int main()
        FILE* fp;
        char c;
        fp=fopen("21-11-11.txt","r");//open the specific file in read mode
        if(fp==NULL)//if the file doesnt conatins any thing or nullvalues return the below statement
                printf("File not Found!!");//file not fonde in console window.
                        c=fgetc(fp);// get each character from file
                        putchar(c);// print each character
                }while(c!=EOF); //check until the end of file
        fclose(fp);//close the file

please any suggestion to resolve this issues :debug assertion failed" in VC++

Thanks in advance

All times are GMT +5.5. The time now is 00:40.