Visual C++ assertion failure -
i creating program copy text file. have main.cpp file reads in text file given filenamein array , output copy of text file given filenameout array. have function declared in fileutilities.h
bool textfilecopy(char filenamein[], char filenameout[]);
then fileutilities.cpp contains
#include <iostream> #include <fstream> #include <string> #include "fileutilities.h" bool fileutilities::textfilecopy(char filenamein[], char filenameout[]) { ifstream fin(filenamein); if(fin.is_open()) { ofstream fout(filenameout); char c; while(fin.good()) { fin.get(c); fout << c; } fout.close(); fin.close(); return true; } return false; }
when compile visual c assertion failure. dialog box titled "microsoft visual c++ debug library" contains following:
"debug assertion failed!
program: .....parser.exe
file f:\dd\vctools\crt_bld\self_x86\crt\src\fopen.c
line 53
expression: (file!=null)"
this error gives me 3 options: abort, retry or ignore. abort stops debug. retry brings message in visual studio says "program.exe has triggered breakpoint". if click break here visual studio opens file called "fopen.c" , points line 54 in file.
if continue point visual studio opens file called "dbghook.c" pointer line 62.
where's error? on fin
or fout
? check corresponding filenamexx
, must not null
Comments
Post a Comment