I had been having a look on the console functions in Windows.h header in the documentation in the MSDN site.
I tried using the FillConsoleOutputAttribute() function and noticed that it doesn't set the color of the text after it.
Then I used the SetConsoleTextAttribute() function.
Now the thing I found was that if I changed the color of the program during runtime at various points, the color of the text preceding the current text would change its color as to the current one as well.
I understood that it was because I was setting the X and Y coordinate to 0.
Now to the problem I had:
Is there a way to get the coordinates of the cursor at a given time so that they can be put into a COORD structure?