Digital --string

#include<string>

using namespace std;

Digital < -> String

long int strtol(const char*nptr,char**endptr,int base);

Analytical : The parameter string nptr the number base (hexadecimal number ) is converted to long int;

   nptr to: 0 X represents 1 . 6 hexadecimal string, 0 (zero ) represents a digit string 8

   endptr: If is N ULL character pointer, will encounter undesirable condition whereby the termination of the return nptr

   Base : the number of decimal used

Example: int n-strtol = ( "0x2D" , NULL , 16 ); // 16 hexadecimal string rotation 1 0 hexadecimal numbers 

qDebug()<<QString::number(n);

The positive numbers. 1 . 6 digit string

   you weather = 1000 ; 

    char buf[100];

    sprintf(buf,"%05x",temp);

    qDebug()<<QString::fromStdString(buf);

Published 104 original articles · won praise 22 · views 40000 +

Guess you like

Origin blog.csdn.net/qq_41672557/article/details/103450237