Live 45 should be somethng like

file.open("student.txt",ios::in|ios::out|ios::binary|ios::app);
if( !file.is_open() ){
//Handle error here
__asm nop;
}

Line 29: if(...