visual studios error please help? c++ unhandled expception


#1

i got this error today working,i attached a image to explain better,Unhandled expception at 0x004010e0 in main.exe: 0xC0000005: Access violation reading location 0x645c3a63,i get this running this line of code here,
here is a image of the code and the error,can any help me,i was passing arguments and compling them,Thanks,Chris^_^
http://img132.exs.cx/img132/183/code0zm.jpg
http://img132.exs.cx/img132/2138/vs5bc.jpg


#2

you are trying to read in a string from the command line without checking to see if it exists.

your code should read as followed:


 
 int main(int argc, char** argv) {
 
 cout << argv[0] << endl;
 
 if(argc >= 3) {
 	 cout << argv[2] << endl;
 }
 
 return 0;
 }
 

Disclaimer: For EVERYONE else out there: I only wrote this out because it was so small that it would take me much longer to explain it without the code. Don’t expect me to do your code for you when you run into a problem!

That is all… :slight_smile:


#3

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.