convert QLineEdit text to Hex Decimal Value in c++
-
I Wrote this code,
void MainWindow::on_ConvertButton_pressed()
{
const std::string test="BM1010";
std::ostringstream result;
result << std::setw(2) << std::setfill('0') << std::hex << std::uppercase;
std::copy(test.begin(), test.end(), std::ostream_iterator<unsigned int>(result, " "));
std::cout << test << ":" << result.str() << std::endl;
}Output :-
BM1010 : 42 4D 31 30 31 30
This code works with String = "BM1010" to Hex Decimal Value.
and, I want to convert QLineEdit text to hex decimal code. -
I Wrote this code,
void MainWindow::on_ConvertButton_pressed()
{
const std::string test="BM1010";
std::ostringstream result;
result << std::setw(2) << std::setfill('0') << std::hex << std::uppercase;
std::copy(test.begin(), test.end(), std::ostream_iterator<unsigned int>(result, " "));
std::cout << test << ":" << result.str() << std::endl;
}Output :-
BM1010 : 42 4D 31 30 31 30
This code works with String = "BM1010" to Hex Decimal Value.
and, I want to convert QLineEdit text to hex decimal code.@Ramkumar-Mohan
So replace theconst std::string test="BM1010";
with the desired QLineEdit::text(). What else is there to say, I don't know why you are asking a question? -
@Ramkumar-Mohan
So replace theconst std::string test="BM1010";
with the desired QLineEdit::text(). What else is there to say, I don't know why you are asking a question?Now, Working Fine Thank you