11-02-2012 02:50 PM
Resolved it..... not sure why it worked.
The error line, which occurs repeatedly but the crash occurs on the 3rd/4th iterarion, was:
char *data = new char[len+1];
Pretty standard right? Anyways, replaced it with the following and it works like a charm:
char* data = (char*)malloc(sizeof(char) * (len+1));