and yes I am trying to count the characters in the file.
and it works perfectly. The error doesn't come until the program reaches literally the end. In debug it breaks after the closing perenthasis of main().
I think you were right when you said that I am trying to put a non char into the chbuf. I changed the section in question to the following and it fixed it.
while(!infile.eof()) { chbuf = infile.get(); if(unsigned char(chbuf) <256) chCount[unsigned char(chbuf)]++; }
and instead of saying "this is a perfect example of how not to do something. why dont you give the right example. This is the for beginners message board after all. why post here if you not a beginner or not someone who would like to help beginners?