Home > Back-end >  Qt char to qstring transformation problem
Qt char to qstring transformation problem

Time:11-28

Define the char pointer assignment for ABC c, traverse the not assigned to a char array d, and a qstring STR (d), and then to transform the STR as bytearray containing ar, into a char * e again, was meant to write the first char c through the encryption to sqlite, read and decryption, the results and compared with d array traversal e found, a great god for help

CodePudding user response:

Talk is being, show me the code.

CodePudding user response:

QString s="abcdefghijklmnopqrstuvwxyz";
Char ch [s.c mount ()];
STD: : string=st1 s.t oStdString ();
Char CD [s.c mount ()];//deposit after taking the characters
Const char * c. C=st1. Data ();
for(int i=0; i{
Char h=* c;
CD [I]=~ h;
c++;
Ch [I]=h;
}
QString s2 (CD);
STD: : string str2=s2. ToStdString ();
Const char * c2=str2. Data ();
Char ch2 [s.c mount ()];
for(int i=0; i{
Char h=* c2;
If (h==[I] CD)//the results are not equal to
QDebug () & lt; <" After take the string and the second into the type char is equal ";
The else
QDebug () & lt; <" Does not equal ";
C2 + +;
Ch2 [I]=~ h;
If (ch2==ch [I] [I])//the results are not equal to
QDebug () & lt; <" After the start of the string and two invert the string equal to ";
The else
QDebug () & lt; <" The last and not equal ";
QDebug () & lt; }
STD: : string str3; Str3. Append (ch2);
QString s3=QString: : fromStdString (str3);//the code
The UI - & gt; TextEdit - & gt; SetText (s3);
  • Related