0

Hi, when i run my program the following error occurs:

"Unhandled exception at 0x00415b72 in testMatrix_size.exe: 0xC0000005: Access violation writing location 0xfdfdfdfd."

and seems to happen over the line converting a string to double:

n = Comma - Position;
Numbers=line.substr(Position,n);
Data[j] = atof(Numbers.c_str()); //problem is here.

The program does the conversion correctly (reading data from a file, data is just rows of numbers in a text file) on the first line and then when at the second line the string Numbers has the correct number stored in it but then the program throws the above error...

Any help would be great, thanks

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Salem
1

Two things
1. 0xfd is used to fill memory after it has been deleted, just in case you try to use it later. So when you see 0xfd all over the place, that is what you should be thinking about.

2. The access violation says "writing", so it's a safe bet that the thing with the problem is the thing on the left hand side of the assignment.

In other words, check your Data, not your string.

Votes + Comments
Helpful! Never knew that always wondered about memory access violations.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.