I was taking a look at the assert() reference page and I got stuck while I read the given example:
/* assert example */ #include #include <
Minor notification: it would be better if you write..
FILE * datafile = NULL;
Also, assert only works in debug mode... so your method is better.