Hmm....well if it actually successfully Sleeps for 1000 milliseconds like you say, then odds are that the problem is not with DessinerCarte(), though it does occur to me that when you send the parameter carte.ScreenBuffer to the WriteConsoleOutput function that it is possible it has not been initialized--though the WriteConsoleOutput() function may take care of this anyway......
But normally when a program crashs abruptly like this it means that you have dereferenced a null pointer somewhere. Since you say you just started learning C++ I'll try to explain what happens.
Any time you have a pointer (which you do in your struct), which is indicated by the * after the type.
So lets say we have:
int *p;
The variable p stores a memory location, which in turn is where an integer is stored.
If we just had :
int i;
Then i simply stores an integer.
If you want to make p point to a specific item, you could say:
p = &i -- The & means "address of" --so in this case p = the address of integer i;
If you wanted to change the value that p points to, then you have to DEREFERENCE p. In c++, you do this by putting a * before it.
So if we have....
int i;int *p; //declare a pointer pp = &i; // set p = to the address of i(*p) = 5; // the parenthesis are for emphasis not needed here
Now the integer i will equal 5.....
Anyway, another thing p can point to is NULL. This basically meams it points to nothing....Any time that you dereference a NULL pointer, the program will crash. Think of it as p points to nothing. By dereferencing it, you are trying to modify the value of nothing.
This is why a lot of times that people use pointers, they put in a safety check before using the star:
if (p != NULL) { *p = whatever;}
So somewhere in your program, there probably is a pointer which is being dereferenced despite pointing to NULL.
I hope my explanation is correct and makes sense.....Someone with more c++ experience maybe can correct me if i made some mistake.
Feel free to email me at NYYanks432@hotmail.com if you have any questions