//write
void write()
{
setlocale(LC_ALL, "en_US.UTF-8");
cout <<"";
}
template <typename A, typename ...B>
void write(string argHead, B... argTail)
{
setlocale(LC_ALL, "en_US.UTF-8");
if (blnBlink==true)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
string a;
a=argHead;
TextBlink(a, csbi.dwCursorPosition.X, csbi.dwCursorPosition.Y,csbi.wAttributes);
COORD Position;
Position.X=csbi.dwCursorPosition.X+strlen(a.c_str());
Position.Y=csbi.dwCursorPosition.Y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),Position);
}
else
cout << argHead;
write(argTail...);
}
template <typename A, typename ...B>
void write(char *argHead, B... argTail)
{
setlocale(LC_ALL, "en_US.UTF-8");
if (blnBlink==true)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
string a;
a=argHead;
TextBlink(a, csbi.dwCursorPosition.X, csbi.dwCursorPosition.Y,csbi.wAttributes);
COORD Position;
Position.X=csbi.dwCursorPosition.X+strlen(a.c_str());
Position.Y=csbi.dwCursorPosition.Y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),Position);
}
else
cout << argHead;
write(argTail...);
}
template <typename A, typename ...B>
void write(A argHead, B... argTail)
{
setlocale(LC_ALL, "en_US.UTF-8");
if (blnBlink==true)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
string a;
//next 2 lines give me an error
a=to_string(argHead);
TextBlink(a, csbi.dwCursorPosition.X, csbi.dwCursorPosition.Y,csbi.wAttributes);
COORD Position;
Position.X=csbi.dwCursorPosition.X+strlen(a.c_str());
Position.Y=csbi.dwCursorPosition.Y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),Position);
}
else
cout << argHead;
write(argTail...);
}
like you see, i'm overloading the write function for diferent types. but i get several errors on last write(). can anyone advice me?
"C:\Users\Joaquim\Documents\CodeBlocks\My Class\console.h|218|error: call of overloaded 'to_string(char*&)' is ambiguous|"