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

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.

commented: Helpful! Never knew that always wondered about memory access violations. +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.