fstream with SetConsoleTextAttribute()

I was working on a game (it's code is currently 1650 lines long), and I came across an issue:

error C2664: 'setcolor' : cannot convert parameter 1 from 'std::string' to 'unsigned int'

I have a 'setcolor' function

1
2
3
4
void setcolor (unsigned int color) { //There is NOT a redefinition issue AT ALL
	HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
        SetConsoleTextAttribute(hcon,color);
}


and here is the code where I change the color:

1
2
3
4
5
6
7
8
9
std::string color; //there is NOT a redefinition issue AT ALL

ifstream file ("settings.txt");

getline(file, color);

file.close();

setcolor(color);


Is there a way to solve this issue WITHOUT converting the string to an intager (or however you spell it)?
Last edited on
Topic archived. No new replies allowed.