Hey,
when I try to run program (its code below), I get an Application Error.
Here is the English translation of error text:
The instruction at "0x7c910fda" addressed at "0xffff0048". The memory could not be "written".
Here is the code of the program:
main.cpp:
#include <SFML/Graphics.hpp>
int main()
{
sf::Color pixelColor;
sf::Image image;
if (!image.loadFromFile("pic.jpg"))
return EXIT_FAILURE;
for (int i=0;i<=image.getSize().x;i++) {
for (int j=0;j<=image.getSize().y;j++) {
pixelColor=image.getPixel(i,j);
image.setPixel(i,j,sf::Color(pixelColor.r,pixelColor.g,255));
}
}
if (!image.saveToFile("pic2.jpg"))//Here is the error
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
With the help of debug I figured out that this error occurs here:
if (!image.saveToFile("pic2.jpg"))//Here is the error
return EXIT_FAILURE;
How to fix it?