Hi!
Below code works fine when it’s run within MSVC. But when run directly, it gives an unhandled exception error. Why is this? Can anyone please point out the place that the exception occur?

Code:
#include<iostream>
#include<fstream>
using namespace std;

void main()
{
	ifstream fs;
	fs.open("lib.txt", ios::in);
	
	while(true)
	{
		char input[20]="\0";
		cout<<"English word(exit-'x'): ";
		cin>>input;
		if(!strcmp(input, "x"))
		{ 
			cout<<"\nBye!\n"<<endl;
			exit(0);
		}
		
		while(fs.peek()!='~')//check data end
		{
			char wrd[20]="\0";
			int i=0;
			char let='\0';
			while(fs.peek()!=':')//check word end
			{
				let = fs.get();
				wrd[i] = let;//create word
				i++;
			}
			
			bool found = false;
			fs.get();//skip ':'
			
			//identical: display non-english word(s)
			if(!strcmp(input, wrd))
			{
				found = true;
				while(fs.peek()!='.')
				{
					cout<< char(fs.get());
				}	
			}
			
			//not identical: skip non-english word(s)
			if(found==false)
			{
				while(fs.peek()!='.')
				{
					fs.get(); 
				}	
			}
			
			fs.get();//skip '.'
		}
		fs.seekg(0);
		cout<<'\n'<<'\n';
	}
}
Thanks.

-geek@02